2 回答

千巷貓影
TA貢獻1829條經驗 獲得超7個贊
要處理動態元素,請引入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()
添加回答
舉報
0/150
提交
取消