如何使用 Selenium 和 Python 绕过 Google CAPTCHA?
当我尝试抓取某些东西时,Google 会给我一个 CAPTCHA。我可以使用 Selenium Python 绕过 Google CAPTCHA 吗?
例如,它是 Google reCAPTCHA。您可以通过此链接查看此 CAPTCHA:https : //www.google.com/recaptcha/api2/demo
无法对iframe使用send_key().如何选择这个iframe以及其中的哪个元素应该用于send_key()?

和iframe HTML代码
<iframe class="textarea" src="/framework/html/blank.html" style="width: 99%; border-width: 1px; height: 332px;">
#document
<html webdriver="true">
<head>
</head>
<body> … </body>
</html>
</iframe>
Run Code Online (Sandbox Code Playgroud)
如何将值发送到描述?
还有一件事我想知道当我在浏览器中查看"查看页面源"时,这个框架代码不会出现吗?
我在住宅代理网络后面的Ubuntu服务器上通过 Selenium 运行 Chrome 驱动程序。然而,我的硒正在被检测到。有没有办法让 Chrome 驱动程序和 Selenium 100% 无法检测?
我已经尝试了很长时间,但我忘记了我所做的许多事情,包括:
我正在寻找 100% 无法检测到的真正 Selenium 版本。如果那曾经存在过。或者机器人跟踪器无法检测到的另一种自动化方式。
这是浏览器启动的一部分:
sx = random.randint(1000, 1500)
sn = random.randint(3000, 4500)
display = Display(visible=0, size=(sx,sn))
display.start()
randagent = random.randint(0,len(useragents_desktop)-1)
uag = useragents_desktop[randagent]
#this is to prevent ip leaking
preferences =
"webrtc.ip_handling_policy" : "disable_non_proxied_udp",
"webrtc.multiple_routes_enabled": False,
"webrtc.nonproxied_udp_enabled" : False
chrome_options.add_experimental_option("prefs", preferences)
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-impl-side-painting")
chrome_options.add_argument("--disable-setuid-sandbox")
chrome_options.add_argument("--disable-seccomp-filter-sandbox")
chrome_options.add_argument("--disable-breakpad")
chrome_options.add_argument("--disable-client-side-phishing-detection")
chrome_options.add_argument("--disable-cast")
chrome_options.add_argument("--disable-cast-streaming-hw-encoding")
chrome_options.add_argument("--disable-cloud-import")
chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--ignore-certificate-errors")
chrome_options.add_argument("--disable-session-crashed-bubble")
chrome_options.add_argument("--disable-ipv6")
chrome_options.add_argument("--allow-http-screen-capture") …Run Code Online (Sandbox Code Playgroud) selenium google-chrome webdriver selenium-chromedriver selenium-webdriver
有没有办法使用geckodriver使您的 Selenium 脚本在 Python 中无法检测到?
我正在使用 Selenium 进行抓取。我们是否需要使用任何保护措施使网站无法检测到 Selenium?
我目前正在从事一个自动填写表格的项目。填写表单时会出现下一个按钮,这就是为什么它给我一个错误。
我试过了:
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//input[@type='button' and @class='button']")))
Next = driver.find_element_by_xpath("//input[@type='button' and @class='button']")
Next.click()
Run Code Online (Sandbox Code Playgroud)
HTML:
<span class="btn">
<input type="button" value="Next" class="button" payoneer="Button" data-controltovalidate="PersonalDetails" data-onfieldsvalidation="ToggleNextButton" data-onclick="UpdateServerWithCurrentSection();" id="PersonalDetailsButton">
</input>
<div class="clearfix"></div>
</span>
Run Code Online (Sandbox Code Playgroud)
错误:
selenium.common.exceptions.ElementClickInterceptedException:消息:元素点击被拦截:元素在点 (203, 530) 处不可点击。其他元素将收到点击:...(会话信息:chrome=76.0.3809.132)
我正在尝试抓取页面,但有时无法单击链接/按钮。
加载网页时,只要该框出现在网站上,“ loadingWhiteBox”将首先出现,然后在几秒钟后消失(但它将保留在HTML代码中),我无法单击链接,并且得到以下错误信息:
selenium.common.exceptions.ElementClickInterceptedException: Message:
Element <span class="taLnk ulBlueLinks"> is not clickable at point
(318.3000030517578,661.7999877929688) because another element <div
class="loadingWhiteBox"> obscures it
Run Code Online (Sandbox Code Playgroud)
有什么办法可以解决此问题?我已经尝试使用以下命令:
driver.is_element_present_by_css('div[class*="loadingWhiteBox"]')
Run Code Online (Sandbox Code Playgroud)
但是即使该元素不处于活动状态,它也存在。
我正在使用硒来抓取一些数据。
我点击的页面上有一个按钮说“custom_cols”。此按钮为我打开一个窗口,我可以在其中选择我的列。
这个新窗口有时需要一些时间才能打开(大约 5 秒)。所以为了处理这个我用过
WebDriverWait
Run Code Online (Sandbox Code Playgroud)
延迟为 20 秒。但有时它无法在新窗口中选择查找元素,即使该元素可见。这种情况只有十次发生一次,其余时间它都可以正常工作。
我也在其他地方使用了相同的功能(WebDriverWait),它按预期工作。我的意思是它会等到元素可见,然后在找到它的那一刻点击它。
我的问题是为什么即使我正在等待元素可见,新窗口上的元素也不可见。要在这里添加,我试图增加延迟时间,但我仍然偶尔会遇到该错误。
我的代码在这里
def wait_for_elem_xpath(self, delay = None, xpath = ""):
if delay is None:
delay = self.delay
try:
myElem = WebDriverWait(self.browser, delay).until(EC.presence_of_element_located((By.XPATH , xpath)))
except TimeoutException:
print ("xpath: Loading took too much time!")
return myElem
select_all_performance = '//*[@id="mks"]/body/div[7]/div[2]/div/div/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[1]/section/header/div'
self.wait_for_elem_xpath(xpath = select_all_performance).click()
Run Code Online (Sandbox Code Playgroud) python selenium web-scraping webdriverwait expected-condition
我很好奇Recaptcha v3的工作方式。特别是浏览器指纹。
当我通过selenium / chromedriver启动chrome实例并针对ReCaptcha 3(https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php)进行测试时,使用selenium /时我总是得到0.1分chromedriver。
在正常实例中使用隐身模式时,我得到0.3。
我通过注入JS并修改Web驱动程序对象并从源代码重新编译WebDriver并修改$ cdc_变量来击败其他检测系统。
我可以看到看起来有些混乱的POST返回到服务器,所以我将开始在那里进行挖掘。
我只是想检查是否有人愿意首先与它分享任何建议或经验,以决定我是否正在运行Selenium / chromedriver?
selenium recaptcha web-scraping selenium-chromedriver recaptcha-v3
是的,我知道两者都习惯于等待某个指定的时间。
硒:
driver.implicitly_wait(10)
Run Code Online (Sandbox Code Playgroud)
Python:
import time
time.sleep(10)
Run Code Online (Sandbox Code Playgroud)
这两者有什么区别吗?
selenium ×9
python ×8
recaptcha ×2
sleep ×2
web-scraping ×2
captcha ×1
exception ×1
firefox ×1
geckodriver ×1
iframe ×1
implicitwait ×1
recaptcha-v3 ×1
splinter ×1
timer ×1
webdriver ×1
xpath ×1