如何在Appium中使用WindowsDriver在单击某个元素之前等待该元素加载
我正在使用Appium和Windows驱动程序来测试我的基于Windows的Dot net应用程序。我试图通过自动化测试点击一个链接。 当我的自动化测试运行时,它不会等待应用程序中的元素(链接)加载/可见。由于这个原因,我的测试失败了。 是否存在WinAppDriver/Windows驱动程序waittillElementisvisible属性(如Selenium Webdriver中的属性),以便它等待元素加载? 非常感谢您的帮助。如何在Appium中使用WindowsDriver在单击某个元素之前等待该元素加载,appium,Appium,我正在使用Appium和Windows驱动程序来测试我的基于Windows的Dot net应用程序。我试图通过自动化测试点击一个链接。 当我的自动化测试运行时,它不会等待应用程序中的元素(链接)加载/可见。由于这个原因,我的测试失败了。 是否存在WinAppDriver/Windows驱动程序waittillElementisvisible属性(如Selenium Webdriver中的属性),以便它等待元素加载? 非常感谢您的帮助。do do { WebEle
do
do
{
WebElement element = ((WindowsDriver) webDriver).findElement(by, using);
try {
if ( element != null ) {
element.click();
Thread.sleep(500);
return;
}
} catch (Exception e) {
logger.debug("Couldnt find element using byType " +by + " locator " + using + " because of exception" + e.getMessage());
attempt++;
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
logger.debug("Exception while sleeping " + e.getMessage());
}
}
} while (attempt < 5 );
throw new WebDriverException("Couldnt find element using byType " +by + " locator " + using );
{
WebElement元素=((WindowsDriver)webDriver).findElement(通过,使用);
试一试{
if(元素!=null){
元素。单击();
睡眠(500);
返回;
}
}捕获(例外e){
debug(“由于异常“+e.getMessage()”,无法使用byType“+by+”定位器“+using+”找到元素);
尝试++;
试一试{
睡眠(500);
}捕捉(中断异常e1){
debug(“睡眠时异常”+e.getMessage());
}
}
}而(尝试次数<5次);
抛出新的WebDriverException(“无法使用byType”+by+“locator”+using找到元素”);
感谢您的回复,但我使用的是Windows驱动程序,而不是WebDriver,因为我的应用程序是基于桌面的应用程序,而且我知道它不支持Wait/FluentWait,它对WebDriver(WebDriverWait)的支持情况如何。我已经编辑了我的答案,您能检查一下它是否正常工作吗?我发现这个解决方案不起作用,因为我没有WebElement,但是WindowsElement和“By”定位器没有在WinAppDriver中实现。我想为Windows元素而不是web元素使用WinApp驱动程序实现。