在硒中绕过capcha [英] get around capcha in selenium
问题描述
是否有任何方法可以使用selenium 2.0,以便我可以启动WebDriver实例,例如firefox,然后手动完成capcha,然后使用WebDriver使用java jar的服务器)接管从那里?
谢谢!
$ b
- 加载BING首页 在测试浏览器中加载搜索结果后,执行搜索
- ,系统会提示用户按下ENTER键
-
从用户搜索的第一个结果链接被点击
driver.get(http://www.bing.com);
System.out.println(Loaded BING homepage);
System.out.println(搜索某个术语,然后按ENTER键);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
reader.readLine();
System.out.println(点击第一个链接...);
driver.findElements(By.className(sa_wr))。get(0)
.findElement(By.tagName(a))。click();
Thread.sleep(3000);
driver.quit();
您可以使用类似的代码来加载登录页面,提示测试者输入CAPTCHA,然后继续测试。
I have a lot of automated tests to run once I've logged into the site I'm unit testing, but I can't (don't have permissions) remove the capcha from the login page.
is there any way to use selenium 2.0 such that I could start the WebDriver instance of, say, firefox, then do the capcha by hand and then have the WebDriver (I use the java jar of the server) "take over" from there?
thanks!
The following snippet:
- loads BING homepage
- prompts the user to perform a search
- once the search results are loaded in the test browser, the user is prompted to press the ENTER key
the first result link from the user's search is clicked
driver.get("http://www.bing.com"); System.out.println("Loaded BING homepage"); System.out.println("Search for some term and then press ENTER"); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader.readLine(); System.out.println("Clicking on the first link ..."); driver.findElements(By.className("sa_wr")).get(0) .findElement(By.tagName("a")).click(); Thread.sleep(3000); driver.quit();
You can use similar code to load the login page, prompt the tester to enter CAPTCHA, and then proceed with the test.
这篇关于在硒中绕过capcha的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!