public class loginTest {
WebDriver driver;@Test(dataProvider="testData")
br/>@Test(dataProvider="testData")
driver.navigate().to(webUrl);
driver.findElement(By.className(cname)).click();
if(webUrl!="xxxxx") {
WebElement email=driver.findElement(By.xpath("//div[@class='userLogin']/div[1]/input[@id='email']"));email.sendKeys("112233@qq.com");
br/>email.sendKeys("112233@qq.com");
WebElement button=driver.findElement(By.id("loginButton"));
button.click();
Assert.assertEquals(btn, button.getText());}else
{
driver.findElement(By.name("login_email")).sendKeys("112233@qq.com");
br/>}else
{
driver.findElement(By.name("login_email")).sendKeys("112233@qq.com");
}
}
@DataProvider(name="testData")
br/>driver.findElement(By.id("login_submit")).click();
}
}
@DataProvider(name="testData")
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();//关闭浏览器
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。