Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

NoSuchElementException is thrown when the requested element is not found even though it is present o

I'm attempting to get the value of the "sitekey" element and store it in a variable, however, I am unable to access it using either XPATH or CSSSELECTOR.


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

Here 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)
Sign In or Register to comment.