您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。