selenium-webdriver笔记六
上一篇 /
下一篇 2012-12-29 00:30:44
/ 个人分类:selenium
51Testing软件测试网|pnB/I2p
z/R4HLQ
*捕作弹出框并确认
k[3Ut2t0Alert alert =
driver.switchTo().alert();51Testing软件测试网
g
vy[Z\$E&E
alert.accept();
rgW!BJ2Mb0 51Testing软件测试网
og%B+pbM|`
alert的其他方法:51Testing软件测试网Hf]1m3Q5C,^A j
dismiss
g
?ebXE:T}!i0gettest
7E4}_z4aLK0sendkeys
h~n,u.w0]/|0
c7Vv;\5IU {U0*隐式等待
.[:l$N0L z A6L0driver.manage().timeouts().implicitlyWait(10,
TimeUnit.SECONDS);51Testing软件测试网z!{1]9_twv*Wt
*显式等待51Testing软件测试网;is*~*qx:D U9^,S)qI
1.WebDriverWait wait = new WebDriverWait(driver,
10);51Testing软件测试网;wM
t%fU%p;g
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("someid")));51Testing软件测试网[X3u[j7xI
需要import org.openqa.selenium.support.ui.ExpectedConditions;
k@3Gx-ie;aX"C0import
org.openqa.selenium.support.ui.WebDriverWait;