Tag: browser automation

维护并重用现有的webdriver浏览器实例 – java

基本上每次我从eclipse运行我的java代码时,webdriver都会启动一个新的ie浏览器并在大多数情况下成功执行我的测试。 但是,我有很多测试要运行,webdriver每次启动一个新的浏览器会话都很痛苦。 我需要一种方法来重用以前打开过的浏览器; 所以webdriver会打开,即第一次,然后第二次,我运行我的eclipse程序,我希望它只是拿起以前的浏览器实例并继续在同一个实例上运行我的测试。 这样,我每次运行程序时都不会启动新的浏览器会话。 假设你有100个测试要在eclipse中运行,你点击那个运行按钮然后它们全部运行,然后在大约第87次测试时你得到一个错误。 然后你回到eclipse,修复那个错误,但是你必须从头再次重新运行所有100个测试。 在第87次测试中修复错误,然后从第87次测试恢复执行,而不是从头开始重新执行所有测试,即从测试0一直到100,这将是很好的。希望,我很清楚得到你们的帮助,谢谢顺便说一下。 以下是我尝试维护和重用webdriver Internet Explorer浏览器实例的尝试: public class demo extends RemoteWebDriver { public static WebDriver driver; public Selenium selenium; public WebDriverWait wait; public String propertyFile; String getSessionId; public demo() { // constructor DesiredCapabilities ieCapabilities = DesiredCapabilities .internetExplorer(); ieCapabilities .setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); driver = new InternetExplorerDriver(ieCapabilities); this.saveSessionIdToSomeStorage(getSessionId); this.startSession(ieCapabilities); driver.manage().window().maximize(); } @Override […]

Selenium – IE 11中的NoSuchWindowException

我试图在IE11中使用selenium自动化网页。 我已将保护模式设置设置为相同级别,缩放级别为100%。 在运行测试时,它会打开网站,但之后会提供例外。 以下是使用的代码。 File file = new File(“C:\\Users\\Desktop\\IEDriverServer.exe”); System.setProperty(“webdriver.ie.driver”, file.getAbsolutePath() ); DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); WebDriver driver = new InternetExplorerDriver(capabilities); driver.get(“http://www.google.com”); 和exception堆栈跟踪 Started InternetExplorerDriver server (32-bit) 2.39.0.0 Listening on port 38122 Jul 11, 2014 1:50:02 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute INFO: I/O exception (java.net.SocketException) caught when processing request: Software caused connection abort: recv failed […]