首页 > 解决方案 > XPath 在使用 Appium Inspector 的应用程序中是动态的

问题描述

我附上了所选元素的屏幕截图 我正在为 iPhone 进行移动应用程序测试,我正在使用 Appium 检查器来识别元素,我有一个场景,机器人在与机器人聊天时回复文本,所以我需要识别首先是文本,因为我只有xpath ,并且一直在变化,除了xpath我还有属性,,,,,,,,,你type能告诉我如何使用我提到的属性首先识别文本吗?enabledvisiblexyheightwidth

public void verify_validatation_message() {
    MobileElement message = (MobileElement) driver.findElementByXPath("//XCUIElementTypeOther[@name=\"label_2\"])[62]/XCUIElementTypeOther");
    String validation_message = message.getText();
    Assert.assertEquals("I can see you've put a term of 45 years", validation_message);
}

所选元素延续的屏幕截图

标签: appiumappium-ios

解决方案


推荐阅读