2 回答

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個(gè)贊
要處理動(dòng)態(tài)元素,請(qǐng)引入WebDriverWait并等待元素elementToBeClickable然后單擊。
試試下面的代碼。
WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='fr mt-header']/a[@class='registrationBtn' and @title='Client-Patient Registration']")));
element.click()
或者
WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='fr mt-header']/a[@class='registrationBtn' and @title='Client-Patient Registration']/span[@class='reg_icon']")));
element.click()
添加回答
舉報(bào)