1

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.

4

2 回答 2

1

您的测试代码总体上看起来不错-对于单个测试)我认为您缺少运行测试的方式-如果您单独运行它,它将打开一个实例。在 testNg 中,您可以使用 dataprovider(参数化)多次运行它,并在 testing.xml 中指定您想要“parallel=methods”,这样您的所有“参数化”测试实例将一起运行。还要确保您在节点起始行(或您想要的任何数字)中有 -browser maxInstances=5。

高效硒检测实验室

[披露:我在拉维罗工作]

于 2013-11-02T12:56:06.067 回答
0

启动服务器时尝试添加此标签 -browser maxInstances=5

于 2013-10-31T20:09:39.013 回答