本文介绍了异常“已传递主参数'webdriver'但未定义主参数创建注释时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经深入浏览了视频并尝试过,但我很震惊,请帮忙.

  • 1) 我尝试了代码,但出现以下错误:

    org.openqa.selenium.SessionNotCreatedException:无法创建新的服务:EdgeDriverService

错误图片

所以后来我发现有一个变化来为这个错误创建一个节点,所以我尝试通过以下方式创建节点:

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node webdriver -hub http://10.144.102.48:4444/网格/注册-端口 5566

还有:

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node webdriver -hub

注意:我正在使用具有不同 IP 地址的新 VM,并且我已将 MicrosoftWebDriver.exeC:\selenium-server-standalone-3.8.1 下载到新的虚拟机.

在此处输入图片描述

解决方案

问题在于你的节点启动命令.

角色的有效值为 hub(启动集线器)(或)node(以节点模式启动 JVM)并且没有值导致JVM 以独立模式出现.

你提供了

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node webdriver -hub http://10.144.102.48:4444/grid/register - 端口 5566

请改成

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node -hub http://10.144.102.48:4444/grid/register -port 5566

请注意,角色已被指定为只是 node 而不是 node webdriver(您提供的)

顺便提一下,我鼓励您将 MicrosoftWebDriver.exe 二进制文件作为 %PATH% 变量的一部分提供.它只是一次性活动,因此不需要您通过 JVM 参数不断传递到它的路径.

I have gone through the video deeply and tried it but I am struck, please help.

  • 1) I tried the code but i getting error of:

Errors Image

So then later I found that there is a change to create a node for this error so i tried to create node by :

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node webdriver -hub  http://10.144.102.48:4444/grid/register -port 5566

and also:

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node webdriver -hub

Note: I am using a new VM with different IP address and I have downloaded MicrosoftWebDriver.exe and C:\selenium-server-standalone-3.8.1 in the fresh VM.

enter image description here

解决方案

The problem lies in your startup command for the node.

Valid values for role are either hub (To start the hub) (or) node (to start the JVM in the node mode) and no value which causes the JVM to come up in a standalone mode.

You provided

Please have this changed to

java -Dwebdriver.edge.driver=C:\MicrosoftWebDriver.exe -jar C:\selenium-server-standalone-3.8.1.jar -role node -hub http://10.144.102.48:4444/grid/register -port 5566

Notice that the role has been specified as just node and not as node webdriver (which you have provided)

On a side note, I would encourage you to have the MicrosoftWebDriver.exe binary available as part of your %PATH% variable. Its only a one time activity and so it wont need you to keep passing in the path to it via the JVM argument.

这篇关于异常“已传递主参数'webdriver'但未定义主参数创建注释时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 17:52