我無法單擊該元素。當我在計算機上執行我的測試時,它運行得很好,但是當我在筆記本電腦上執行我的測試時,它卻失敗了。獲取錯誤元素不可點擊。我也嘗試使用不同的等待時間。不知道問題出在哪里。這就是我正在使用的: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貢獻1818條經驗 獲得超7個贊
您可以按如下方式更新現有代碼:
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();
添加回答
舉報
0/150
提交
取消