确保 webdriver 打开的浏览器始终处于焦点
问题描述:
如果浏览器窗口未聚焦,则当前页面上的所有 webdriver 识别失败.
If the browser window is not in focus, all webdriver identifications on the current page fail.
如何使用 webdriver 使浏览器成为焦点?
How can the browser be brought into focus, using webdriver?
答
((JavascriptExecutor) webDriver).executeScript("window.focus();");
应该可以解决问题!