2018-09-10_類常見類型方法容器_ui自動化框架
自動化窗口切換
// 獲取當(dāng)前頁面句柄
String handle = driver.getWindowHandle();
//執(zhí)行操作產(chǎn)生新窗口
driver.findElement(By.xpath("http://div[@id='content_left']/div[1]//a/em')]")).click();
for (String handles : driver.getWindowHandles()) {
//循環(huán)從列表中每次去一個值放在變量里面
if (handles.equals(handle)) {
//如果當(dāng)前取得窗口handle跟原窗口一致
continue;
} else {
//就繼續(xù)
driver.switchTo().window(handles);
//切換窗口根據(jù) 列表中當(dāng)前拿出來的窗口handle切換
}
}
類:
- 自定義類(自定義存在不同的包下面)
- 第三方類(存在Maven的jar包里面)
- JDK類(存在JDK的jar包里面,屬于官方類)
方法:
1.不帶參數(shù)的方法
2.帶參的方法
3.帶返回數(shù)據(jù)的方法
4.不帶返回數(shù)據(jù)的方法
數(shù)據(jù)類型:
1.整數(shù)型
1. byte
2. short
3. int
4. long
2.浮點(diǎn)型
1. float
2. double
字符
1. char邏輯型
1. boolean-
引用類型
- 數(shù)組
- 類
- 接口
常用容器
1. list 有排序 但是只能存單值(可重復(fù))览徒,通過下標(biāo)取值
2. HashMap 只能存鍵值對 通過key取值
3. HashSet 數(shù)據(jù)不能重復(fù)着降,無序 通過循環(huán)迭代取值
4.1.數(shù)組 有順序 有位數(shù) 大小固定执庐,只能存儲相同類型的數(shù)據(jù) 通過下標(biāo)取值
Testng常見注解
@Beforeclass
@Beforetest
@Test
@Aftertest
@Afterclass
ui自動化框架
image.png