无法使用selenium网格打开多个浏览器

时间:2016-03-29 11:11:22

标签: java selenium selenium-rc selenium-grid

我是selenium grid的新手。我想以并行模式进行测试。我尝试了如下。但它不会打开多个浏览器。我不知道自己做错了什么。

我的代码:

for(int i=0;i<=10;i++){
        RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.firefox());
        driver.navigate().to("http://gmail.com");
    }

Selenium Hub:

java -jar selenium-server-standalone-2.52.0.jar -role hub

Selenium Node:

java -jar selenium-server-standalone-2.52.0.jar -role node -hub http://localhost:4444/grid/register -port 5560 -browser browserName=firefox,maxInstance=3 -maxSession 3

Hub中的信息打印:

16:38:28.581 INFO - Available nodes: [http://192.168.1.28:5560]

16:38:28.581 INFO - 尝试在节点http://192.168.1.28:5560上创建新会话

Configuration

2 个答案:

答案 0 :(得分:0)

我找到了解决方法。 我只是在命令中犯了错误。

我应该使用 maxInstance 而不是 maxInstances

命令应该是这样的

java -jar selenium-server-standalone-2.52.0.jar -role node -hub http://localhost:4444/grid/register -port 5580 -browser browserName=firefox,maxInstances=3 -maxSession=3

答案 1 :(得分:0)

命令中的

maxInstance = 3是错误的。它应该是'maxInstances = 3'。