在使用JAVA的硒Webdriver中运行测试时,我不希望网页在屏幕上出现。有没有程序运行的方式,并且网页看不到。在测试时将网页隐藏在硒webdriver中
2
A
回答
1
如果你没有足够的预算有专门的机器来运行测试,那么一个简单的窍门是运行浏览器关闭屏幕:
ChromeOptions options = new ChromeOptions();
options.addArguments("--window-position=-32000,-32000");
WebDriver driver = new ChromeDriver(options);
driver.get("http://stackoverflow.com");
0
是的,你可以做到这一点像下面使用HtmlUnitDriver它打开在无头的模式下您的网页,即没有任何网页的知名度有关HTML单元驱动器的详细信息,请访问
https://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/htmlunit/HtmlUnitDriver.html
也visit http://stackoverflow.com/questions/12807689/selenium-vs-htmlunit
无w回到问题
WebDriver driver = new HtmlUnitDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// do some action with html unit driver
// for example open google home page
driver.get("http://www.google.com");
// now verify that google home page is loaded properly
System.out.println("Printing Title of the Google Home Page : " + driver.getTitle());
// above line prints on console : Printing Title of the Google Home Page : Google
相关问题
- 1. 硒+ TestNG的测试网页
- 2. 硒的webdriver - 我试图让所有链接在网页中
- 3. 硒webdriver测试使用C#
- 4. 硒的webdriver - 隐藏的选择和锚
- 5. 如何在Web测试硒期间禁用互联网? WebDriver,Java
- 6. 测试中硒负流量的webdriver
- 7. 硒的webdriver +蟒蛇 - 无法隐藏在行动
- 8. 在我的测试网页中使用Selenium webdriver
- 9. PlayFramework ScalaTest测试网页与硒
- 10. 无法在硒webdriver中保存页面
- 11. 在ASP.NET网站中隐藏页面URL
- 12. 硒2.0 webdriver的测试编译错误
- 13. 硒的webdriver - 删除Cookie和测试
- 14. 硒的webdriver跨越测试用例
- 15. 在同一窗口中打开硒Webdriver测试
- 16. Joomla - 创建隐藏的测试页面
- 17. 策略在JavaScript测试硒的webdriver在不同的环境
- 18. 在c#中使用硒webdriver滚动网页#
- 19. 无法通过硒webdriver在Firefox中打开网页
- 20. 在网页中使用硒执行javascript WebDriver
- 21. NUnit测试在硒网格上失败
- 22. 硒的webdriver不能识别网页上
- 23. 在硒中测试页面加载时间的正确方法?
- 24. Node.js硒webdriver隐身模式
- 25. 硒的webdriver - 如何远离测试登录测试
- 26. 如何在Chrome运行硒webdriver的测试用例移动网站
- 27. 硒网格:确定webdriver的节点,在一个测试失败发生
- 28. 硒博客网站测试
- 29. 单元测试时,成员隐藏
- 30. Java - 测试时隐藏系统输出
您可以尝试使用PhantomJS驱动程序。 – JRodDynamite