Reputation: 635
I am using selenium grid(JUNIT, Java) to run my test case on mutli instance of browser.
I used "java -jar selenium-server-standalone-2.20.0.jar -role hub" to run hub.
and "java -jar selenium-server-standalone-2.20.0.jar -role webdriver -hub http://machineip
:4444/grid/register -port 5566" to run node.
I verified that both are running fine.
But when I run testcase through eclipse only one instace of browser opened.
i used this piece of code.
@Test
public void method() throws MalformedURLException {
baseUrl = "https://www.google.co.in";
nodeUrl = "http://`machinip`:5566/wd/hub";
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.WINDOWS);
driver = new RemoteWebDriver(new URL(nodeUrl), capability);
// WebDriver driver = new FirefoxDriver();
driver.get(baseUrl);
driver.findElement(By.xpath("//td/div/input")).sendKeys("lucky");
}
Can please someone suggest how can i open multiple instance for single test.
Thanks in advance for help.
Upvotes: 1
Views: 1707
Reputation: 51
you test code looks good in general - for a single test) i think you are missing the way you run the test - if you run it single time it will open a single instance. in testNg you can run it using dataprovider (parameterized) several times, and specify in testing.xml that you want "parallel=methods", this way all your "parametrized" instances of the test will run together. also make sure that u have -browser maxInstances=5, in the node start line (or any number that you want).
efficient selenium testing lab
[disclosure : i work at Ravello]
Upvotes: 1
Reputation: 332
Try adding this tag when starting the server -browser maxInstances=5
Upvotes: 0