首页 > 解决方案 > 如何在 iOS 应用上查看非仪表化元素

问题描述

我正在尝试为 iOS 应用程序运行自动化脚本。我正在使用“仪器”方法。但是,有时有些领域是用这些方法看不到的,只有用非仪器方法才能看到的。请问如何在只能读取仪器字段的代码中读取 non_instrument 字段?

我使用了nixpathnon_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();

}

标签: javaeclipseautomated-testsappium-ios

解决方案


推荐阅读