我想从https://www.archionweb.be/在这个页面https://www.archionweb.be/Public/Company/1930上抓取电子邮件。
电子邮件在验证码中受到保护,所以想法是点击验证码然后提取电子邮件。但是每当我尝试单击验证码按钮(我同时使用 XPath 和 CSS 选择器)时,就会出现异常:
“没有这样的元素:无法找到元素”
请如果有人可以帮助我。
由于我们即使在点击I am not a Robot
它之后也在自动化,有时会再次重新验证。能够点击带有以下代码的复选框。
from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome(executable_path="path to chromedriver.exe")
driver.maximize_window()
driver.implicitly_wait(30)
driver.get("https://www.archionweb.be/Public/Company/1930")
time.sleep(5)
iframe = driver.find_element_by_xpath("//iframe[@title='reCAPTCHA']")
driver.switch_to.frame(iframe)
time.sleep(5)
recaptcha = driver.find_element_by_class_name("recaptcha-checkbox-borderAnimation")
driver.execute_script("arguments[0].scrollIntoView(true);",recaptcha)
ActionChains(driver).move_to_element(recaptcha).click().perform()
time.sleep(2)
driver.switch_to.default_content()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句