基于 SELENIUM 的自动化测试架构(22)
发表于:2017-04-11来源:gitbook作者:凌俣Linty?点击数:
标签:selenium
@throws InterruptedException */ @Test public void test01ChangeLanguage () throws InterruptedException { WebDriver driver = this .baseDriver; driver.get( this .baseUrl); Thread.sleep( 2000 ); // 点击语
@throws InterruptedException
*/
@Test
public void test01ChangeLanguage() throws InterruptedException {
WebDriver driver =
this.baseDriver;
driver.get(
this.baseUrl);
Thread.sleep(
2000);
driver.findElement(By.cssSelector(
"#langs > button")).click();
Thread.sleep(
500);
driver.findElement(By.cssSelector(
"#langs > ul > li:nth-child(3) > a")).click();
Thread.sleep(
2000);
String expected_language =
"English";
String actual_language =
driver.findElement(By.cssSelector(
"#langs > button")).getText();
Assert.assertEquals(actual_language, expected_language);
}
/**
* 测试前置条件
* 在所有的测试开始前 执行一次
*/
原文转自:http://gitbook.cn/books/58e54b57cfcd6fa52dcef1d2/index.html