我对硒很新,所以从头开始学习。
我正在创建一个测试,我想测试每个链接,验证它已经转到正确的页面,然后返回到我开始的页面。第一部分是登录到站点并验证我在正确的页面上,但我无法执行第二个@Test。
@Test
public void LoginTest() {
driver.navigate().to("https://test.barclays.lifestyleservicesgroup.co.uk/");
driver.findElement(By.xpath(".//*[@id='security']")).click();
driver.findElement(By.xpath(".//*[@id='EmailAddress']")).sendKeys("autobarc001@test.lifestylegroup.co.uk");
driver.findElement(By.xpath(".//*[@id='Password']")).sendKeys("Abcd1234!");
driver.findElement(By.xpath(".//*[@id='main-content']/div[2]/div[2]/form/div[1]/div[2]/span/input")).click();
Assert.assertTrue(driver.findElement(By.xpath(".//*[@id='main-content']/div[2]/h1")).isDisplayed());
}
//Checking claim process link on homepage
@Test
public void claimProcessTest (){
driver.findElement(By.xpath(".//*[@id='helpful-info']/div[2]/ul/li[1]/a")).click();
Assert.assertTrue(driver.findElement(By.xpath(".//*[@id='main-content']/div[2]/div[1]/h1")).isDisplayed());
driver.findElement(By.xpath(".//*[@id='current-nav']/a")).click();
}
//Closing browser after execution
@AfterClass
public static void tearDown () {
driver.close();
}
}