2016-12-24 66 views
1

硒webdriver的代码是:Internet Explorer未启动我的硒的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:组织.testng.internal.InvokeMethodRunnable $ TestNGRuntimeException:java.lang.RuntimeException:转发新会话时发生错误找不到:Capabilities [{ensureCleanSession = true,acceptSslC erts = true,requireWindowFocus = true,browserName = IE,version =,platform = WINDOWS}]

+0

请帮助我运行网格上的Internet Explorer –

回答

0

-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 
+0

感谢兄弟的回答。在节点文件中进行这些更改后仍然会抛出相同的异常。 –

+0

代码的相同代码模式正在为chrome工作。 –

0

问题就出在你的测试代码执行它。

错误转发新的会话找不到

是告诉你,无论你请求节点(根据你的能力),电网不能其节点的农场中发现的网格的方式。

测试代码请求的浏览器,其名称为IE,但电网具有支持名为的Internet Explorer

线

能力= DesiredCapabilities浏览器只有一个节点。IE浏览器();

已经妥善设置浏览器名称。

所以你不需要下面的线(这是造成问题的线):

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

请删除该行并重试。

而且它能够更好地调整通过nodeConfig JSON文件的节点功能,而不是你想通过命令行来传递他们(其易于使用命令行的时候犯错误)

This文件应该可以帮助您面向JSON节点配置。

+0

感谢兄弟的回答。在这些变化之后仍然是例外。 –

+0

代码的相同代码模式正在为chrome工作。 –

+0

@AmarNathYadav - 你能为你的错误显示新的堆栈跟踪吗?我很肯定,它不会与你在问题中包含的内容相同。 –