我们已经成功在Chrome和Firefox上使用Selenium测试,现在我们想要使用Internet Explorer在Windows 10虚拟机上开始测试。到目前为止,测试已经开始,Internet Explorer打开并进入我们要测试的页面。但是任何与页面的交互都会使测试失败,但它找不到任何元素。错误通常是'xpath无法找到元素'。 Chrome和Firefox在同一台机器上运行相同的测试。无法在Internet Explorer中运行Selenium测试
0
A
回答
0
这里有一些清单,通过Internet Explorer来执行:
确保您使用的是最新的硒3.x的罐子IE 11
下沿您需要下载“ IEDriverServer“(32位)从here。
在设置系统属性时提供“IEDriverServer”的绝对路径。
这里是IE 11打开Gmail和与有效凭证登录的代码:
(具有有效的用户ID &替换YOUR_ID用有效的密码替换your_password)
//Internet Explorer 11
System.setProperty("webdriver.ie.driver", "C:\\SeleniumUtilities\\BrowserDrivers\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.manage().window().maximize();
driver.get("http:\\\\gmail.com");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.id("Email")).sendKeys("your_id");
driver.findElement(By.id("next")).click();
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Passwd")));
driver.findElement(By.id("Passwd")).sendKeys("your_password");
driver.findElement(By.id("signIn")).click();
driver.quit();
请让我知道这对你有没有用。
0
我得到它的工作。问题是我需要关闭Internet Explorer中所有安全区域的保护模式 - > Internet设置 - >安全性。
相关问题
- 1. 如何在Internet Explorer中运行selenium rc测试用例
- 2. Internet Explorer Selenium量角器e2e测试
- 3. Internet Explorer测试
- 4. 如何使Selenium运行Internet Explorer更快?
- 5. 无法运行Selenium HtmlUnitDriver测试(java.net.SocketException)
- 6. Selenium 2:无法为Internet Explorer设置PROXY
- 7. Selenium在Internet Explorer中的wait_for_condition
- 8. 在Internet Explorer中运行量角器测试?
- 9. 无法在Internet Explorer
- 10. JavaScript中的倒数计时器无法在Internet Explorer中运行
- 11. 使用Selenium在不同文档模式下测试Internet Explorer
- 12. 硒测试在Internet Explorer上运行速度非常慢
- 13. Selenium RC和Internet Explorer
- 14. 如何在Internet Explorer中测试Rails Juggernaut?
- 15. jenkins selenium不运行测试
- 16. 是否有类似于在Internet Explorer 7上运行的Selenium IDE?
- 17. Selenium RC脚本未在Internet Explorer上运行
- 18. 如何在Jenkins中运行Selenium测试
- 19. 使用WaitForElement进行aurelia测试,同时在Internet Explorer中运行Karma
- 20. 无法在Selenium运行测试时打开网页
- 21. 无法在某些浏览器上运行Selenium测试
- 22. 想法如何运行Selenium测试
- 23. 运行Selenium测试上GRID2
- 24. JavaScript未在Internet Explorer中运行
- 25. 如何在Internet Explorer中运行vbs
- 26. 如何在Internet Explorer中运行fullCalendar?
- 27. ionic2应用程序无法在Internet Explorer上运行
- 28. Flash无法在Windows 8/Internet Explorer 10上运行
- 29. 无法在Eclipse中运行junit测试
- 30. 无法在CppUnitTestFramework(VS2013)中运行测试
设置与元素交互之前的一些等待时间。 IE可能响应缓慢,因此在该特定元素之前提供一些等待时间并检查 –