当我通过Selenium使用PhantomJS获得recaptcha V2挑战(选择答案和图片)时,挑战比经典浏览器(例如Chrome或Firefox)更难......
Recaptcha如何到达检测PhantomJS?
我的代码:
PhantomJSOptions options = new PhantomJSOptions();
options.AddAdditionalCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
options.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true);
options.AddAdditionalCapability("requireWindowFocus", true);
options.AddAdditionalCapability("enablePersistentHover", false);
PhantomJSDriver driver = new PhantomJSDriver(options);
driver.Navigate().GoToUrl("http://deathbycaptcha.com/");
Console.WriteLine("Page ouverte");
driver.Manage().Window.Maximize();
driver.SwitchTo().Frame(driver.FindElement(By.Name("undefined")));
driver.FindElement(By.CssSelector("div[class=recaptcha-checkbox-checkmark]")).Click();
Thread.Sleep(1500);
lock(lockThis){
driver.GetScreenshot().SaveAsFile("screeno.jpg", ImageFormat.Jpeg);
}
Console.WriteLine("Screen realise")
一些想法?
答案 0 :(得分:1)
尝试安装fiddler并比较程序中发送的标头与标准浏览器http://www.telerik.com/fiddler。
答案 1 :(得分:0)
使用PhantomJS时需要更改用户代理。