D
D
DAnya782021-11-13 21:29:26
Python
DAnya78, 2021-11-13 21:29:26

Why doesn't it find the element in the frame?

I tried to click on the captcha and did not find the element in the frame I
tried to go here https://www.google.com/recaptcha/api2/demo passed but on Facebook it does not work

driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
    # update the class name based on the UAT implementation (if it's different)
    driver.find_element_by_class_name("recaptcha-checkbox-border").click()

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".recaptcha-checkbox-border"}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
naitiq, 2021-11-13
@naitiq

Try with xpath

driver.find_element_by_xpath('//*[@id="recaptcha-anchor"]/div[1]')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question