简体   繁体   English

C# Selenium 解决google ReCaptcha, iFrame 问题

[英]C# Selenium solving google ReCaptcha, iFrame issues

currently, I automate some processes using selenium and need to solve Google ReCaptcha.目前,我使用 selenium 自动化了一些流程,需要解决 Google ReCaptcha。 The technology used to solve the ReCaptcha is the browser, Plugin Buster.用于解决 ReCaptcha 的技术是浏览器 Plugin Buster。 I enter the Google ReCaptcha using the following我使用以下输入 Google ReCaptcha

driver.SwitchTo().Frame(0);
driver.FindElement(By.Id("recaptcha-anchor")).Click();

Now I switch back to the default Frame using:现在我使用以下命令切换回默认框架:

driver.SwitchTo().DefaultContent();

Now I try to enter the Google ReCaptcha Menu Frame and click the Buster icon, using the following code.现在我尝试使用以下代码进入 Google ReCaptcha 菜单框架并单击 Buster 图标。

driver.SwitchTo().Frame(Indexoftheframetoenter);
driver.FindElement(By.CssSelector("#solver-button")).Click();

Icon to click要点击的图标

The problem with that is, the index seems to be a random lower number, which causes my code not to click the icon.问题是,索引似乎是一个随机的较低数字,这导致我的代码没有点击图标。 I managed to "solve" this issue with ugly try and catch blocks, covering a specific amount of numbers.我设法用丑陋的 try and catch 块“解决”了这个问题,涵盖了特定数量的数字。 I am not familiar with iFrame.我对 iFrame 不熟悉。 Is there a way to guess this specific iFrame?有没有办法猜测这个特定的 iFrame?

Thank you very much非常感谢

Update.更新。 It helped me to write down what I wanted.它帮助我写下我想要的东西。 Noticed you can also enter iFrames using their names.请注意,您还可以使用名称输入 iFrame。 I leave this here for the community.我把这个留给社区。

driver.SwitchTo().Frame("recaptcha challenge");

Google detects that it is a bot and does not perform the audio captcha, so this method will be of little use to you via selenium谷歌检测到它是一个机器人并且不执行音频验证码,所以这个方法对你用处不大 selenium

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM