java - Internet Explorer 未启动我的 selenium webdriver 代码

标签 java selenium-webdriver selenium-grid

Selenium WebDriver 代码是:

File file = new File("D:\\Polycom_Space\\WebdriversIEDriverServer_x64_2.53.1\\IEDriverServer.exe");

System.setProperty("webdriver.ie.driver",file.getAbsolutePath());
capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "IE");
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability("requireWindowFocus", true);
driver = new RemoteWebDriver(host, capabilities);



**//grid node configuration is---**

cd Polycom_Space\Java Libraries Server
java -jar selenium-server-standalone-2.53.1.jar -role webDriver -hub http://localhost:4242/grid/register -port 5557 -Dwebdriver.ie.driver=D:\Polycom_Space\Webdrivers

\IEDriverServer_x64_2.53.1\IEDriverServer.exe -browser browserName="internet explorer" -maxInstances=4 -maxSession 1

异常(exception)是:

org.testng.internal.thread.ThreadExecutionException: org.testng.internal.InvokeMethodRunnable$TestNGRuntimeException: java.lang.RuntimeException: Error forwarding the new session cannot find : Capabilities [{ensureCleanSession=true, acceptSslCerts=true, requireWindowFocus=true, browserName=IE, version=, platform=WINDOWS}]

最佳答案

-D 属性应该位于 jarfile 之前(否则它会被视为应用程序的参数,而不是 JVM 的选项)。 从java帮助中,用法是

java [-options] -jar jarfile [args...]

尝试执行它

java -Dwebdriver.ie.driver=D:\Polycom_Space\Webdrivers\IEDriverServer_x64_2.53.1\IEDriverServer.exe -jar selenium-server-standalone-2.53.1.jar -role webDriver -hub http://localhost:4242/grid/register -port 5557 -browser browserName="internet explorer" -maxInstances=4 -maxSession 1

关于java - Internet Explorer 未启动我的 selenium webdriver 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41314430/

相关文章:

java - TestNG Java Selenium 。 Thread.sleep() 的替代方法是什么

javascript - 获取点击后打开新页面的url

log4j - 如何配置log4j和Selenium Grid?

java - 使用 ThreadCount TestNG 限制并行测试的数量

java - 混合容器/客户端模式下的 Arquillian 和 Selenium

Java 与 C# 类名

java - GridBagLayout 中的对齐方式(小程序)

java - Java 是否允许在其定义中使用当前类的实例?

java - 尝试使用 Gecko 驱动程序运行 selenium Grid 代码时获取 "The path to the driver executable must be set by the webdriver.gecko.driver "

java - boolean 值字符串到数组?