当我编写自动化测试并运行它们(在我的 PC 上)时,我无法工作,直到测试完成,因为例如,如果我正在编码,焦点将跳出 Visual Studio,转到查看的被测 Web 应用程序在网络浏览器中.
When I write automated tests and run them (on my PC) I can not work until the tests are finished, because for example if I am coding the focus will jump out of visual studio to go to the web application under test viewed in web browser.
有没有办法防止 Selenium 驱动程序窃取焦点?
Is there a way to prevent Selenium driver from stealing focus?
你不仅不能阻止 WebdDiver
获取焦点,你也不应该这样做.WebdDiver
需要将焦点放在浏览器上才能成功与之交互.如果你把焦点放在 WebdDiver
将无法执行像 FindElement()
、Click()
或任何其他操作和测试将失败.
Not only you can't prevent the WebdDiver
from taking the focus, you shouldn't do it. The WebdDiver
needs the focus on the browser in order to successfully interact with it. If you take the focus the WebdDiver
won't be able to perform actions like FindElement()
, Click()
or any other operation and the tests will fail.
这篇关于Selenium 测试工作时如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!