我正在研究 Selenium,我目前有一个集线器连接到两个运行 linux 和所有浏览器的 vm。
我能够启动浏览器。但是,尽管我有两个 vm,但我的所有测试都在单个 vm 上的单个浏览器上运行。Selenium 不会在 vm 中启动多个浏览器。我已将最大实例设置为 5,它反映在我的 gris 控制台中。我有需要在 linux 和 windows vm 上运行的测试套件,并且它必须同时运行。我使用 WebDriver 像这样调用我的网格。
capabilities = new DesiredCapabilities();
capabilities.setBrowserName("firefox");
driver = new RemoteWebDriver(new URL("http://XXX.XXX.XXX.:4444/wd/hub"), capabilities);
这就是我创建测试套件的方式:
testNames.add(SupportPortalTestSuite.class.getName());
JUnitCore.main(testNames.toArray(new String[testNames.size()]));
此外,当我注册我的节点时,我得到:
11:28:47.403 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","capabilities":[{"platform":"LINUX","seleniumProtocol":"Selenium","browserName":"*firefox","maxInstances":5},{"platform":"LINUX","seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5},{"platform":"LINUX","seleniumProtocol":"Selenium","browserName":"*iexplore","maxInstances":1},{"platform":"LINUX","seleniumProtocol":"WebDriver","browserName":"firefox","maxInstances":5},{"platform":"LINUX","seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":5},{"platform":"WINDOWS","seleniumProtocol":"WebDriver","browserName":"internet explorer","maxInstances":1}],"configuration":{"port":5555,"register":true,"host":"10.235.132.161","proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","maxSession":5,"hubHost":"10.235.1.50","role":"node","registerCycle":5000,"hub":"http://10.235.1.50:4444/grid/register","hubPort":4444,"url":"http://10.235.132.161:5555","remoteHost":"http://10.235.132.161:5555"}}
11:28:47.407 INFO - starting auto register thread. Will try to register every 5000 ms.
我需要同时在 vms 上的所有可用浏览器上运行测试。