【问题标题】:UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server with Selenium GridUnreachableBrowserException:无法启动新会话。可能的原因是使用 Selenium Grid 的远程服务器的地址无效
【发布时间】:2019-02-22 10:25:19
【问题描述】:

打开新的驱动程序窗口时出错:

org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

服务器日志:

Forwarding newSession on session null to remote

我在 linux 上运行以下代码:

driver= new RemoteWebDriver((new URL( "http://"+ip+":5555/wd/hub")), capability);

我的中心节点已经启动并运行。那为什么我会收到这个错误。

【问题讨论】:

    标签: selenium selenium-webdriver webdriver selenium-grid remotewebdriver


    【解决方案1】:

    此错误消息...

    org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    

    和服务器日志...

    Forwarding newSession on session null to remote
    

    ...暗示 Selenium Grid Hub / Selenium Grid Node 未正确启动/启动。结果,null session 被转发到 RemoteWebDriver


    关于您使用的二进制文件版本的更多信息,包括 Selenium 服务器/客户端、WebDriver 变体 /version 和 WebBrowser变体 /version 以及您用来启动 Selenium Grid Hub / Selenium Grid 节点 的命令会帮助我们以更简单的方式调试您的问题。

    但是,由于以下多种因素,可能会发生此问题:

    • 您正在使用 uri 5555/wd/hub,因此请确保 Selenium Grid Hub 在端口 5555 上启动。
    • 您可以选择将capability 参数替换为Options 类的实例,如下所示:

      DesiredCapabilities caps = new DesiredCapabilities();
      caps.setCapability("browser", "chrome");
      //seting the required capabilities
      ChromeOptions options = new ChromeOptions();
      options.merge(caps);
      WebDriver driver = new RemoteWebDriver((new URL( "http://"+ip+":5555/wd/hub")), options);        
      
    • 可以在Remote WebDriver UnreachableBrowserException: Could not start a new session找到相关讨论

    • 由于您使用的二进制文件的版本不匹配,GeckoDriver/Selenium/Mozilla 经常会出现此问题。作为一个经验法则,始终遵循GeckoDriver, Selenium and Firefox Browser compatibility chart 中的配置矩阵

    【讨论】:

      猜你喜欢
      • 2020-02-25
      • 2019-04-25
      • 2017-11-02
      • 2022-01-23
      • 2022-01-04
      • 2019-07-07
      • 2015-09-07
      相关资源
      最近更新 更多