2 回答
TA贡献1810条经验 获得超4个赞
检查元素是否在框架内如果是 - 然后 - 首先选择框架 -
Select Frame name or id of iframe
然后执行以下操作 -
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//a[@ng-show='canCreate']"))).click();
如果没有框架那么你可以直接与元素交互 -
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//a[@ng-show='canCreate']"))).click();
TA贡献1757条经验 获得超7个赞
您需要添加显式等待条件,尤其是在处理包含 Angular JS 元素的页面时
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();
添加回答
举报