标签:remote lse testng web com malformed rem public browser
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");
}
}
三、TestNG 数据驱动注解,可配合Grid支持多node机器,多浏览器同时运行脚本
标签:remote lse testng web com malformed rem public browser
原文地址:https://www.cnblogs.com/surenliu/p/12388763.html