jeudi 28 mai 2020

Click on spam with python selenium

I want to click on the checkbox from the Google ReCAPTCHA-test. For that (I think) I have to Click on the Following span:

<span class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" role="checkbox" aria-checked="false" id="recaptcha-anchor" tabindex="0" dir="ltr" aria-labelledby="recaptcha-anchor-label"><div class="recaptcha-checkbox-border" role="presentation"></div><div class="recaptcha-checkbox-borderAnimation" role="presentation"></div><div class="recaptcha-checkbox-spinner" role="presentation"><div class="recaptcha-checkbox-spinner-overlay"></div></div><div class="recaptcha-checkbox-checkmark" role="presentation"></div></span>

https://patrickhlauke.github.io/recaptcha/ Here the Website is (it's just an empty website with an ReCAPTCHA in it)

I am using the latest version of the Chrome driver and it's defined as driver. I tried:

driver.find_element_by_tag_name("span").click()

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

driver.find_element_by_id('recaptcha-anchor').click()

driver.find_element_by_class_name('recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox').click()

but i'm always getting following error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {*this is every try different*}
  (Session info: chrome=83.0.4103.61)

I hope someone can help me clicking on this span, course I'm very new at Python and Its my first try with Selenium :)




Aucun commentaire:

Enregistrer un commentaire