Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些在 FireFox 上成功运行的 SeleniumWebdriver/TestNG 测试。如果我正在观看测试运行,那没关系。但是如果我同时开始使用另一个浏览器,或者例如Skype,然后我回到运行测试的FireFox窗口,我总是会发现发生了一些错误——例如,“用户名”输入没有已填写。
为什么会发生这种情况,我该如何预防?
driver.switchTo().window(driver.getWindowHandle());填写表格时尝试使用。
driver.switchTo().window(driver.getWindowHandle());