我無法單擊該元素。當(dāng)我在計(jì)算機(jī)上執(zhí)行我的測試時(shí),它運(yùn)行得很好,但是當(dāng)我在筆記本電腦上執(zhí)行我的測試時(shí),它卻失敗了。獲取錯(cuò)誤元素不可點(diǎn)擊。我也嘗試使用不同的等待時(shí)間。不知道問題出在哪里。這就是我正在使用的:WebDriverWait wait=new WebDriverWait(driver,30);wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@ng-click='startExam()']"))).click;Action action=new Actions(driver);actions.moveToElement(ele).perform();action.movetoElemet(ele).click().perform.這是我在檢查控制臺中所擁有的:<button class="btn btn-primary ng-scope" ng-if="!proctoredSession" ng-click="startExam()" ng-dissabled="!isExamContentLoaded">Start Exam</button>==$0
3 回答

qq_笑_17
TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超7個(gè)贊
您可以按如下方式更新現(xiàn)有代碼:
WebDriverWait wait=new WebDriverWait(driver,30);
Action action=new Actions(driver);
WebElement temp = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@ng-click='startExam()']")));
action.moveToElement(temp).click().perform();
添加回答
舉報(bào)
0/150
提交
取消