Selenium 硒网格可以';t管理专用网络中的节点

Selenium 硒网格可以';t管理专用网络中的节点,selenium,selenium-grid,Selenium,Selenium Grid,服务器端 我们的Selenium网格服务器具有公共IP地址(104.131.xxx.xxx) 节点 专用网络中有节点计算机(192.168.43.xxx)。他们能够连接到Selenium服务器而没有任何问题: java -jar selenium-server-standalone-3.4.0.jar -role webdriver -hub http://104.131.xxx.xxx:4444/grid/register -port 3456 问题 3.1服务器上有重复的消息: Re

服务器端

我们的Selenium网格服务器具有公共IP地址(104.131.xxx.xxx)

  • 节点

    专用网络中有节点计算机(192.168.43.xxx)。他们能够连接到Selenium服务器而没有任何问题:

    java -jar selenium-server-standalone-3.4.0.jar -role webdriver -hub http://104.131.xxx.xxx:4444/grid/register -port 3456
    
  • 问题

    3.1服务器上有重复的消息:

    Registered a node http://192.168.43.248:3456
    Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
    Unregistering the node http://192.168.43.248:3456 because it's been down for 60060 milliseconds
    Cleaning up stale test sessions on the unregistered node http://192.168.43.248:3456
    
    Registered a node http://192.168.43.248:3456
    Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
    ......
    
    3.2我们不能开始任何测试。当我们尝试开始时,我们得到:

    Got a request to create a new session: Capabilities [{marionette=true, loadImages=false, acceptInsecureCerts=true, browserName=firefox}]
    Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=firefox, maxInstances=5, platform=WIN10}
    Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
    Unregistering the node http://192.168.43.248:3456 because it's been down for 60050 milliseconds
    Cleaning up stale test sessions on the unregistered node http://192.168.43.248:3456
    Removed a session that had not yet assigned an external key f83395be-cb27-43a3-8999-b5573f387715, indicates failure in session creation PROXY_REREGISTRATION
    Registered a node http://192.168.43.248:3456
    Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
    
    3.3试验的痕迹:

    selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Error forwarding the request Connect to 192.168.43.248:3456 [/192.168.43.248] failed: Connection timed out (Connection timed out)
    

  • 我们应该创建VPN网络还是Selenium Grid有一些特殊的方法来管理这个问题?


    另外,当我们将Selenium服务器移动到本地环境时,一切都正常。

    主要问题不是节点无法向集线器注册自身,而是集线器的ping(集线器以预定的间隔不断向节点发送心跳信号,以检查节点是否启动或关闭)未到达节点。我猜这可能是因为集线器和节点位于不同的网络上,因此双向通信没有发生

    这非常类似于我在Amazon云计算机上运行Selenium Hub并将其暴露于外部世界,然后尝试在我的本地计算机上生成Selenium节点(也具有internet连接),并尝试将此节点连接到Hub

    从节点到集线器的注册将起作用,因为我的机器(节点在其上运行)能够发现在云上运行的集线器(该集线器暴露在外部),但当集线器尝试向我的节点发送心跳信号时,尝试失败,因为我的计算机将发送其内部IP地址,该地址仅在本地网络中可见,但在外部不可见,而这是集线器将用于发送心跳信号的IP地址

    这更像是一个网络问题,与Selenium网格无关

    底线是,您需要确保Selenium Hub和Selenium节点位于同一网络上。因此,您可以通过VPN配置来完成(我不是网络专家,因此我不能就如何实现这一点发表更多评论)(或者)将集线器移动到与节点相同的网络


    希望这能增加清晰度。

    如果您使用公共ip作为集线器,则必须允许防火墙中的端口3456与节点连接。但它可以使用相同的ip进行注册。我很怀疑,你为什么要在公众中运行你的中心?@Murthi,我们公司有很多员工,我们想在他们的环境中测试我们的产品。他们的电脑位于家庭W-Fi中。因此,他们可以毫无问题地上网,并且能够在Selenium服务器上注册(连接已建立)。但由于某些原因,服务器无法访问此计算机。有两种解决方案可能有效。1.您可以使用vpn连接连接到集线器。2.您可以使用家庭网络的公共ip从家中注册到集线器。谢谢!这正是发生的事情。我们还认为,我们需要创建一个VPN网络。谢谢你的确认。
    selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Error forwarding the request Connect to 192.168.43.248:3456 [/192.168.43.248] failed: Connection timed out (Connection timed out)