public class GridTest2 {
/
设置数据驱动数据
/
@DataProvider(name = "data_1")
public Object[][] test1(){
return new Object[][]{
{"firefox","http://192.168.1.105:8888"},
{"chrom","http://192.168.1.105:5555"}
};
}
/*
调用数据驱动数据,并判断数据进行对应的Grid创建,支持不同浏览器在不同node跑脚本
*/
@Test(dataProvider = "data_1")
public void testProvider(String browser,String url) throws MalformedURLException {
DesiredCapabilities dc = null;
if (browser.equals("firefox")){
dc=DesiredCapabilities.firefox();
}else if(browser.equals("chrom")){
dc=DesiredCapabilities.chrome();
}else {
System.out.println("DataProvider.name.data_1,未包含该驱动");
}
WebDriver driver = new RemoteWebDriver(new URL("http://192.168.1.105:5556/wd/hub"),dc);
driver.get("http://www.baidu.com");
}
}