2

我启动集线器和节点:

java -jar C:\...\selenium-server-standalone-2.25.0.jar -role hub
java -jar C:\...\selenium-server-standalone-2.25.0.jar -role node 
    -hub http://localhost:4444/grid/register 
    -browser browserName=chrome,maxInstances=6,platform=WINDOWS 
    -timeout 0
    -Dwebdriver.chrome.driver=c:\...\chromedriver.exe

然后,我创建 Chrome 驱动程序实例:

    Dim desiredCapabilities As Remote.DesiredCapabilities = Remote.DesiredCapabilities.Chrome()
    Dim size As String = "--window-size={0},{1}"
    size = String.Format(size, browserWidth, browserHeight)
    Dim position As String = "--window-position={0},{1}"
    position = String.Format(position, browserWidth * index, 0)
    desiredCapabilities.SetCapability("chrome.switches", {size, position})
    driver = New Remote.RemoteWebDriver(New System.Uri("http://localhost:4444/wd/hub"), desiredCapabilities)

五个工作正常。第六次等待 Selenium 响应。这是错误:

OpenQA.Selenium.WebDriverException: No response from server for url http://localhost:4444/wd/hub/session. Aborting test execution.

节点中没有活动,因此集线器似乎没有将第六个请求分配给节点。maxInstances=6除了我需要的设置之外,还有其他设置吗?

4

1 回答 1

1

我尝试为每五个浏览器在不同的端口上运行单独的节点,它起作用了:

中心:

java -jar C:\...\selenium-server-standalone-2.25.0.jar -role hub

前五名:

java -jar C:\...\selenium-server-standalone-2.25.0.jar -role node -port 5555
    -hub http://localhost:4444/grid/register 
    -browser browserName=chrome,maxInstances=5,platform=WINDOWS 
    -timeout 0
    -Dwebdriver.chrome.driver=c:\...\chromedriver.exe

下五个:

java -jar C:\...\selenium-server-standalone-2.25.0.jar -role node -port 5556
    -hub http://localhost:4444/grid/register 
    -browser browserName=chrome,maxInstances=5,platform=WINDOWS 
    -timeout 0
    -Dwebdriver.chrome.driver=c:\...\chromedriver.exe
于 2012-08-02T20:55:32.307 回答