我有一些硒测试在(本地和远程)中运行良好,但是当我从我的机器远程运行它们到 Windows 2012 虚拟机时,在单击按钮移动到下一个网页 后Chrome
,他们找不到任何元素。
这是一个代码片段:
DesiredCapabilities caps = null;
caps = DesiredCapabilities.internetExplorer();
caps.setBrowserName("internet explorer");
caps.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
caps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
caps.setJavascriptEnabled(true);
caps.setPlatform(Platform.WIN8);
String nodeURL = "http://0.0.0.0:5555/wd/hub"
driver = new RemoteWebDriver(new URL(nodeURL), caps);
// IE launches correctly, goes the cart page. Calculations are done on the pricing, and we click to move to the login page
driver.findElement(By.id("userName")).sendKeys("test@test.com");
// ^^ NoSuchElementException: Unable to find element with id == userName
所以很明显有一个很好的联系。执行操作,我的测试从购物车页面移动到登录页面。我什至添加了一个wait.until
,希望这是一个时间问题,但它在 15 秒后超时。我在看 RDP 上的驱动程序,它移到了页面。在这 15 秒内,我什至打开了开发工具并检查了该元素是否存在并且确实存在。
这是怎么回事?谢谢!