我试图在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");
Run Code Online (Sandbox Code Playgroud)
和异常堆栈跟踪
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
Jul 11, 2014 1:50:02 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Exception in thread "main" org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide …Run Code Online (Sandbox Code Playgroud) 我试图在IE 10中使用selenium自动化网站.该网站打开正常但是当我想点击一个元素(按钮)时,它找到元素并点击它,但是元素状态(按钮名称改变)需要要改变不会改变.
这是我的代码.
File file = new File("D:/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.midomi.com");
driver.findElement(By.id("searchMovielanding")).click();
Run Code Online (Sandbox Code Playgroud)
我试过两台机器.在一台机器上代码正常运行而在另一台机器上没有看到click事件改变元素状态.我检查了网页上的元素,然后发现它不知道为什么它没有在一台机器上正确点击它.
if(driver.findElements(By.id("searchMovielanding")).size() != 0) {
System.out.println("Element Found");
}
Run Code Online (Sandbox Code Playgroud)
任何帮助解决这个问题.
selenium internet-explorer browser-automation selenium-webdriver
我们如何使用java编程计算图像中的亮度、对比度、色调和饱和度。任何公式,代码片段表示赞赏。