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");
}
}
原文地址:https://www.cnblogs.com/surenliu/p/12388763.html
时间: 2024-10-03 17:42:38