当前位置: 首页 > 面试题库 >

RemoteWebDriver引发“ org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话”

慕璞
2023-03-14
问题内容

我正在尝试从集线器到节点运行一个简单的代码,集线器和节点连接成功。

执行程序时出现异常

org.openqa.selenium.SessionNotCreatedException

我提到的Chrome驱动程序路径是可以从节点计算机访问的共享路径。

  • Chrome版本:58.0.3029.110
  • Chrome驱动程序版本:2.9

集线器和节点都是远程计算机。

下面是使用的代码:

public static void main(String[] args) throws MalformedURLException {

    WebDriver driver;
    System.setProperty("webdriver.chrome.driver", "Q:\\xxxxx\\chromedriver.exe");
    DesiredCapabilities dc = new DesiredCapabilities();
    dc.setBrowserName("chrome");
    dc.setPlatform(Platform.VISTA);
    driver = new RemoteWebDriver(new URL("http://10.xx.xxx.xx:5566/wd/hub"), dc); //node url
    driver.get("https://www.google.com");

}

下面是控制台消息:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, platform=VISTA}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'A5DAFC-W7A-0012', ip: '10.xx.xxx.xx', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
    at testcases.Grid.main(Grid.java:23)

问题答案:

这是您问题的答案:

当您使用以下命令启动 Selenium Grid Hub时

 java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4123

要通过浏览器执行代码块chromedriver.exeGoogle Chrome您可以考虑通过以下命令在端口 5566* 上启动
Selenium Grid Node
*

java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4123/grid/register -port 5566

通过访问Selenium Grid Hub控制台 <IP_of_GridHub>:4123/grid/console查看正在注册的节点。

让我知道这是否回答了您的问题。



 类似资料:
  • 我正试图使用Selenium Grid启动一款新的Chrome浏览器,但最终出现以下错误 无法创建新的远程会话。所需功能=能力[{浏览器名称=chrome,版本=55.0.2,平台=WINDOWS}],所需功能=能力[{}]构建信息:版本:“3.0.1”,修订版本:“1969d75”,时间:“2016-10-18 09:49:13 -0700”系统信息:主机:“PL9710388”,ip:“10.

  • 当我尝试运行测试时,我得到这个错误。 sessionNotCreatedException:无法创建新的远程会话。所需功能=功能[{PlatformName=Android,DeviceName=F4AZFG07P508}],所需功能=功能[{}]生成信息:版本:“3.3.1”,修订版:“5234B325D5”,时间:“2017-03-10 09:10:29+0000”系统信息:主机:“MacBo

  • null 我的脚本中使用的代码: 详细的堆栈跟踪: an 19,2017 6:07:36 PM org.openqa.selenium.remote.ProtocolHandshake创建session信息:尝试双方言会话,假设Postel定律在远程端成立,Jan 19,2017 6:07:37 PM org.openqa.selenium.remote.ProtocolHandshake创建se

  • 我正在学习Appium,我无法使用以下功能创建远程会话。虽然>功能在模拟设备上的Appium server本身中工作 线程“main”org.openqa.selenium.sessionNotCreatedException中出现异常:无法创建新的远程会话。原始错误:127.0.0.0.1生成信息:版本:“3.141.59”,修订版:“E82BE7D358”,时间:“2018-11-14T08:

  • 我正在尝试使用Selenium Grid在不同的机器(Windows 10)上启动Firefox(51.0.1版)、Chrome(56.0.2924.87版)、Edge(38.14393.0.0版)**和Opera(43.0版)**。它在Chrome浏览器上运行良好,但在其他浏览器上总是会出现一些问题。请查看以下错误消息: 组织。openqa。硒。SessionNotCreatedExceptio

  • 我想通过使用selenium网格在两个设备上做并行执行。从建立JSON开始,每台设备都运行Appium Desktop。 与Appium建立的连接: ->它给我在创建Driver实例时的错误。