为了账号安全,请及时绑定邮箱和手机立即绑定

找到 reCAPTCHA 元素并点击它——Python + Selenium

找到 reCAPTCHA 元素并点击它——Python + Selenium

qq_遁去的一_1 2021-09-25 16:10:40
我需要帮助。有网址:https://www.inipec.gov.it/cerca-pec/-/pecs/companies。我需要点击复选框验证码: 我的代码看起来像:import os, urllib.request, requests, datetime, time, random, ssl, json, codecs, csv, urllibfrom urllib.request import Request, urlopenfrom urllib.request import urlretrievefrom datetime import datetimefrom selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.common.exceptions import NoSuchElementExceptionfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ECfrom selenium.common.exceptions import NoAlertPresentExceptionfrom selenium.webdriver.chrome.options import Optionschromedriver = "chromedriver"os.environ["webdriver.chrome.driver"] = chromedriverchrome_options = webdriver.ChromeOptions()driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=chrome_options)driver.get("https://www.inipec.gov.it/cerca-pec/-/pecs/companies")driver.switch_to_default_content()element = driver.find_elements_by_css_selector('iframe')[1]driver.switch_to_frame(element)driver.find_elements_by_xpath('//*[@id="recaptcha-anchor"]/div[1]').click()在执行过程中,出现错误:driver.find_elements_by_xpath('//*[@id="recaptcha-anchor"]/div 1 ').click() AttributeError: 'list' 对象没有属性 'click'请帮助修复它。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 327 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号