【问题标题】:How to use Ios UI Automation xpath in appium for ios如何在 appium for ios 中使用 iOS UI 自动化 xpath
【发布时间】:2016-03-04 03:06:44
【问题描述】:

我正在使用 iosuiautomator 查找元素的 xpath

(注意:在 appium 中找不到 xpath)。运行时显示以下错误

【问题讨论】:

    标签: appium ios-ui-automation appium-ios


    【解决方案1】:

    使用iOSUIAutomation搜索策略时,不需要localTarget().target.().etc。您可以从mainWindow() 之后开始。我还注意到您将点击操作放在引号内,但实际上是移动元素的一个函数(并且有 2 个参数),所以您想要的是:

    driver.findElementByIosUIAutomation(".tableViews()[2].cells()[2]").tap(1, 250)

    【讨论】:

    • 您好,感谢您的回复。其实我是新来的 appium 。使用上面的代码时出现“方法 tap(int, int) 未定义 WebElement 类型”的错误。 @econoMichael
    • 你的驱动应该初始化为IOSDriver<MobileElement>
    • 但我仍然遇到同样的问题。即使在初始化之后。
    • 公开课applaunch { IOSDriver driver; DesiredCapabilities cap= new DesiredCapabilities(); cap.setCapability("appium-version", "1.14.3");cap.setCapability("app","/Users/manigandan/Downloads/iOrder_UAT_2.2.1.00V.ipa"); // 应用 cap.setCapability("platformName", "iOS"); cap.setCapability(CapabilityType.VERSION,“8.1.3”); driver = new IOSDriver(new URL("127.0.0.1:4723/wd/hub"), cap); driver.findElementByIosUIAutomation(".mainWindow().buttons()[22]").tap(1,250)
    • IOSDriver driver; 更改为IOSDriver<MobileElement> driver;
    猜你喜欢
    • 2017-08-03
    • 2016-07-29
    • 2014-09-03
    • 2018-10-25
    • 2016-09-10
    • 2015-02-07
    • 2021-01-24
    • 2017-10-15
    • 2016-02-27
    相关资源
    最近更新 更多