本文共 1244 字,大约阅读时间需要 4 分钟。
public class loginTest {
WebDriver driver;}}@DataProvider(name="testData")br/>driver.findElement(By.id("login_submit")).click();}}@DataProvider(name="testData")public static Object[][] dataBase(){ return new Object[][] { {"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxxr","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","touXiang","Login","Register Now"},{"xxx","customer poRe","Login","Register Now"} };}@BeforeClass
public void beforeClass() { //修改浏览器语言ChromeOptions op=new ChromeOptions();op.addArguments("--lang=en-US");//初始化一个chrome浏览器实例,实例名称叫driver driver = new ChromeDriver(op);//浏览器窗口最大化driver.manage().window().maximize();//设置页面资源加载时间//driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);//设置页面元素查找时间driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);}@AfterClass
public void afterClass() { driver.close();//关闭浏览器}}
转载于:https://blog.51cto.com/12390959/2055084