繁体   English   中英

Internet Explorer未启动我的selenium webdriver代码

[英]Internet Explorer is not launching my selenium webdriver code

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

例外情况是:

org.testng.internal.thread.ThreadExecutionException:org.testng.internal.InvokeMethodRunnable $ TestNGRuntimeException:java.lang.RuntimeException:转发新会话时出错无法找到:Capabilities [{ensureCleanSession = true,acceptSslCerts = true,requireWindowFocus = true,browserName = IE,版本=,平台= 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

问题在于您的测试代码。

转发新会话时出错无法找到

是网格的方式告诉您,无论您请求的节点(基于您的能力),网格都无法在其节点场中找到。

您的测试代码正在请求名称为IE的浏览 ,但Grid只有一个支持名为Internet Explorer的浏览器的节点

这条线

能力= DesiredCapabilities.internetExplorer();

已经负责正确设置浏览器名称。

所以你不需要以下行(这是引起问题的行):

capabilities.setCapability(CapabilityType.BROWSER_NAME,“IE”);

请删除该行,然后重试。

最好通过nodeConfig JSON文件调整节点功能,而不是尝试通过命令行传递它们(使用命令行时容易出错)

文档应该可以帮助您使用JSON节点配置进行定向。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM