selenium grid listening on node port instead of hub port

后端 未结 3 1702
离开以前
离开以前 2020-12-20 07:30

For my test, I am running grid and node locally on different ports.

java -jar /usr/bin/selenium-server.jar -port 4444 -role hub
java -jar /usr/bin/selenium-s         


        
相关标签:
3条回答
  • 2020-12-20 07:44

    There might be a chance, that your previous Grid configuration on the port 4444 was not closed properly. you just if any process is running with the port 4444 and shutdown it. you can use below commands to know the process which is running and to turn of the process.

    C:\Users\username>netstat -o -n -a | findstr 0.0:4444
    TCP    0.0.0.0:4444      0.0.0.0:0              LISTENING       3116
    C:\Users\username>taskkill /F /PID 3116
    

    Then Reconfigure the Grid and run it may work with port 4444 --all the best.

    0 讨论(0)
  • 2020-12-20 07:56

    If you intend to use Selenium in Grid configuration through Hub and Node configuration, I would suggest you to use the most recent selenium-server-standalone-3.6.0 jar as follows:

    1. Start the Selenium Grid Hub (by default on port 4444) :

      java -jar selenium-server-standalone-3.6.0.jar -role hub
      
    2. Confirm the Selenium Grid Hub is started:

      16:06:29.891 INFO - Nodes should register to http://192.168.1.48:4444/grid/register/
      16:06:29.891 INFO - Selenium Grid hub is up and running
      
    3. Access the Selenium Grid Hub Console and ensure Selenium Grid Hub is up and running:

      http://localhost:4444/grid/console
      
    4. Start the Selenium Grid Node (by default on port 5555) for Mozilla/GeckoDriver:

      java -Dwebdriver.gecko.driver=geckodriver.exe -jar selenium-server-standalone-3.6.0.jar -role node -hub http://localhost:4444/grid/register
      
    5. Confirm the Selenium Grid Node is registered and started:

      16:15:54.696 INFO - Selenium Grid node is up and ready to register to the hub
      16:15:54.742 INFO - Starting auto registration thread. Will try to register every 5000 ms.
      16:15:54.742 INFO - Registering the node to the hub: http://localhost:4444/grid/register
      16:15:54.975 INFO - The node is registered to the hub and ready to use
      
    6. Execute with the Testcase with DesiredCapabilities as follows:

      self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=caps)
      
    7. Observe the console logs ending with the following on successful execution of your Testcase:

      16:23:50.590 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@37ff9771
      16:23:50.590 INFO - Handler thread for session 31a1dcb0-8bed-40fb-acdb-d5be19f03ba2 (firefox): Executing DELETE on /session/31a1dcb0-8bed-40fb-acdb-d5be19f03ba2
       (handler: ServicedSession)
      1506941630595   Marionette      INFO    New connections will no longer be accepted
      
    0 讨论(0)
  • 2020-12-20 07:58

    You are passing desired_capabilities which is mostly the Module to the server which is not correct.

    driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=desired_capabilities)
    

    Should be

    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
    
    driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=DesiredCapabilities.FIREFOX)
    
    0 讨论(0)
提交回复
热议问题