【发布时间】:2018-12-04 17:01:35
【问题描述】:
问题 - 无法通过 winium.desktop.driver 在窗格中找到窗格。因此,无法识别窗格内的元素。
以下是一些可能有所帮助的细节。
我正在使用 Selenium Java 绑定。
应用程序是具有嵌入式 HTML 元素的桌面应用程序。据我了解,窗口内显示有页面/框架。我正在使用 winium 桌面驱动程序来完成测试自动化。请在下面的代码。 堆栈跟踪显示“未找到元素”。
我的理解是,pane2 没有被识别,因为它在 pane1 内,因此我无法识别 pane2 内的元素。 pane2 的唯一属性不足。
代码:
WebElement mainWindow = driver.findElement(By.id(‘WebBrowserForm’));
WebElement pane1 = mainWindow.findElement(By.xpath(“//*[@Name=’Contact: New Contact’][@LocalizedControlType=’pane’]”));
String p1 = pane1.getAttribute(“ProcessId”);
WebElement pane2 = pane1.findElement(By.xpath(“//*[@ProcessId=’” +p1+ ”’][ @LocalizedControlType=’pane’][@Name=’’]”));
WebElement el1 = pane2.findElement(By.xpath(“//*[@ProcessId=’” +p1+ ”’][ @LocalizedControlType=’text’][ @Name=’Suffix’]”));
el1.click();
Any help would be much appreciated.
【问题讨论】: