如何使用 selenium 和 Ruby for Mac OSx 在后台运行 chrome 驱动程序? [英] How to run chrome driver in background using selenium with Ruby for Mac OSx?
本文介绍了如何使用 selenium 和 Ruby for Mac OSx 在后台运行 chrome 驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有时,浏览器窗口出现在前台,我不小心点击了它,这在某些情况下会导致测试失败.所以,我只想知道,有什么办法可以让 Chrome 驱动程序窗口保持在后台.
Sometimes, the browser window comes to the foreground and I'm clicking it accidentally which makes the test fails on some occasions. So, I just want to know, is there any way that I can keep the chrome driver window in the background.
详情:<ChromeDriver 版本:2.28.455517 ><Chrome 版本:58.0.3029.96 >
Details: < ChromeDriver version: 2.28.455517 > < Chrome version: 58.0.3029.96 >
推荐答案
关于您的问题的解决方案的几句话:
A few words about the solution to your Question:
- 根据最佳实践,您应该尝试在具有所有必需的硬件和软件的隔离测试环境中执行您的测试脚本/自动化框架 配置和设置.
- 在执行过程中,不应有任何手动用户交互.
- 如果您想进行多任务处理,请使用 Ghost/Headless Browsers.您将在 哪些驱动程序支持no-browser"中找到详细讨论"/无头"测试?.
- Htmlunitdriver &PhantomJS 是两个最广泛使用的 Ghost/Headless 浏览器.
- 如果您具体使用 ChromeDriver,则可以按照 文档 这里.
- As per best practices, you should try to execute your Test-scripts / Automation-framework in an isolated Test Environment with all the required Hardware and Software configurations and setup.
- While the execution is in process, there should be no manual user interaction in-between.
- In-case you want to do multitasking, use Ghost/Headless Browsers. You will find a detailed discussion in Which drivers support "no-browser"/"headless" testing?.
- Htmlunitdriver & PhantomJS are the two mostly widely used Ghost/Headless Browsers.
- If you are specific about using ChromeDriver you can use Chrome headless as per the documentation here.
这篇关于如何使用 selenium 和 Ruby for Mac OSx 在后台运行 chrome 驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文