java - 如何在 iOS 应用上查看非仪表化元素
问题描述
我正在尝试为 iOS 应用程序运行自动化脚本。我正在使用“仪器”方法。但是,有时有些领域是用这些方法看不到的,只有用非仪器方法才能看到的。请问如何在只能读取仪器字段的代码中读取 non_instrument 字段?
我使用了nixpath
non_instrument 字段的参数,但是 eclipse 看不到这个参数。
@Test (description="Login with wrong username and password")
@Parameters({ "Username_KO" , "Password_KO" })
public void login_fail1(String Username_KO, String Password_KO) throws Exception {
driver.findElement(By.xpath("//*[@class='UIView' and ./*[@text='' and ./*[@text='Username']]]"))
.sendKeys(Username_KO);
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@class='_UIButtonBarButton']")));
driver.findElement(By.xpath("//*[@class='_UIButtonBarButton']"))
.click();
driver.findElement(By.xpath("//*[@class='UIView' and ./*[@text and ./*[@accessibilityLabel='Password']] and ./*[@class='UIImageView']]"))
.sendKeys(Password_KO);
driver.findElement(By.xpath("//*[@class='_UIButtonBarButton']"))
.click();
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@accessibilityLabel='Sign In' and @class='FMS.Button']")));
driver.findElement(By.xpath("//*[@accessibilityLabel='Sign In' and @class='FMS.Button']"))
.click();
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@text='FMS' and @class='UIAStaticText']")));
driver.findElement(By.niXpath("//*[@text='FMS' and @class='UIAStaticText']"))
.click();
driver.findElement(By.nixpath("//*[@text='Wrong username or password. Please try again']"));
driver.findElement(By.nixpath("//*[@text='Ok']"))
.click();
}
解决方案
推荐阅读
- powershell - 如何在克隆的 GitHub 存储库上成功地在本地运行 Pester 单元测试?
- javascript - 如何在不使用 void 的情况下重新启动 CSS 动画?
- vba - 在我的驱动器中保存 Outlook 消息的问题
- javascript - 如何将数组的最后一个字段添加在一起
- java - 字符串的Java插入排序方法不起作用
- string - sed 用特殊字符替换字符串
- python - 标记数据框中的异常值,在熊猫中创建一个新列
- php - 向已注销的用户隐藏多种 Woocommerce 运输方式
- python - 根据python中另一列的条件增加一列
- linux - Terraform 在 local-exec 中设置 Bash 变量如何包含换行符?