[英]Selenium WebDriver - Application becomes unresponsive after clicking on Save button
I am automating one of the scenario which contains entering few details and then click on Save button.我正在自动化包含输入一些细节的场景之一,然后单击“保存”按钮。 Manually when i am performing the steps, it hardly takes 5 to 8 sec to process and complete.
当我手动执行这些步骤时,处理和完成几乎不需要 5 到 8 秒。 But same performing via automation script, it just keep on loading for infinite time.
但是同样通过自动化脚本执行,它只是无限时间地继续加载。
Below is the html code for Save button :下面是保存按钮的 html 代码:
<button class="blueFilledButton ng-binding" ng-click="validateIdea(validateIdeaForm)" ng-disabled="userNotFound || PoupupButtonDisabled || incorrectValidDate" tabindex="0" aria-disabled="false">Save</button>
Selenium code: I have tried with below click methods : Selenium 代码:我尝试过以下点击方法:
Case - 1 :情况1 :
driver.findElement(By.xpath("//button[text()='Save']")).click();
Case - 2 :案例 - 2:
Actions builder = new Actions(driver);
builder.moveToElement(driver.findElement(By.xpath("//button[text()='Save']"))).click().perform();
In both the cases it just keeps on loading.在这两种情况下,它都会继续加载。
Is it due to any script is being invoked after clicking on Save button, and webdriver is not compatible with it?是不是因为点击保存按钮后调用了任何脚本,而webdriver与之不兼容?
Please help.请帮忙。 Thanks in advance.
提前致谢。
根据 HTML,您已将<button>
与文本共享,因为Save是一个Angular 元素,因此您必须引入WebDriverWait以使元素可点击,如下所示:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='blueFilledButton ng-binding'][@ng-click=\"validateIdea(validateIdeaForm)\"]"))).click();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.