Can I run Selenium on Computer A, and see the browser in Computer B?

前端 未结 2 1025
不知归路
不知归路 2021-02-11 04:04

Imagine I have some Selenium Project ready on Computer A. When you run this project, a new browser opens in Computer A, and connects to www.somesite.com and runs the tests..

相关标签:
2条回答
  • 2021-02-11 04:39

    You can look up this documents to better understand RemoteWebDriver

    In short things you would need to do

    1. Download Selenium Server on Computer B
    2. Start the server on Computer B by doing so java -jar selenium-server-standalone-2.32.0.jar
    3. Change your code on Computer A from WebDriver driver = new FirefoxDriver();

    to

    DesiredCapabilities capability = DesiredCapabilities.firefox();    
    WebDriver driver = new RemoteWebDriver(new URL("http://computerB:4444/wd/hub"), capability);
    

    And if all the required ports are open, it should all work well.

    0 讨论(0)
  • 2021-02-11 04:43

    That's exactly what Selenium Grid is for!

    Have fun

    And please reconsider the usage of Selenium RC which is actually an undead, better use the RemoteWebDriver instead.

    0 讨论(0)
提交回复
热议问题