selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element Even tho its there

17 views Asked by At

I've been trying to access this element I have tried XPATH, CSSSELECTOR and none worked. I'm trying to acces sitekey= and pass it into a variable.

I'm expecting the function to return the sitekey to a variable.

Heres is my code:

driver.find_element(By.XPATH, '//*[@id="modal-content"]/div/div[2]/div').click()
KeyElement = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, 'captcha-widget')))
key = KeyElement.get_attribute("data-sitekey")
print(key)
0

There are 0 answers