2 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
檢查元素是否在框架內(nèi)如果是 - 然后 - 首先選擇框架 -
Select Frame name or id of iframe
然后執(zhí)行以下操作 -
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//a[@ng-show='canCreate']"))).click();
如果沒(méi)有框架那么你可以直接與元素交互 -
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//a[@ng-show='canCreate']"))).click();

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超7個(gè)贊
您需要添加顯式等待條件,尤其是在處理包含 Angular JS 元素的頁(yè)面時(shí)
WebElement newStudyEnrollment= driver.findElement(By.xpath("//a[contains(text(),'New
Study Enrollment')]"));
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(newStudyEnrollment));
newStudyEnrollment.click();
添加回答
舉報(bào)