提问人:Bhars 提问时间:9/15/2023 最后编辑:Bhars 更新时间:9/27/2023 访问量:21
有没有另一种方法可以在 appium 上找到 xpath,也许是通过使用自定义 xpath,就像你使用网站一样?
Is there another way to locate xpath on appium perhaps by using Custom xpaths like how you can with websites?
问:
我正在尝试在 Android 真实设备上的移动应用程序上执行自动化。
开发人员尚未添加元素 ID,因此我唯一可以使用查找元素的是 xpath。
我已设法启动该应用程序,输入登录详细信息并登录该应用程序,但它在主页上找不到其他 xpath。
我发现 xpath 正在使用 Appium Inspector。
这是我试图找到并单击的 Xpath。
“//android.widget.SeekBar[@content-desc=”Bottom Sheet“]/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[6]/android.view.ViewGroup/android.view.ViewGroup/android.widget.TextView[1]”
有没有另一种方法来定位 xpath,也许是通过使用自定义 xpath,就像您使用网站一样。
提前感谢您的帮助。:)
显示错误代码
给定用户登录其帐户 # StepDefenitions.VerifyAndLogoutSteps.user_logs_in_to_their_account() 当用户检查帐户页面时 # StepDefenitions.VerifyAndLogoutSteps.user_checks_account_page() org.openqa.selenium.NoSuchElementException:使用给定的搜索参数无法在页面上找到元素。 有关此错误的文档,请访问: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Build info: version: '4.11.0', revision: '040bc5406b' 系统信息: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202' 驱动程序信息:io.appium.java_client.android.AndroidDriver 命令:[10ca0517-85de-47f1-b30a-2cf866486336, findElement {using=xpath, value=//android.widget.SeekBar[@content-desc=“Bottom Sheet”]/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[6]/android.view.ViewGroup/android.view.ViewGroup/android.widget.TextView[1]}] 能力
我尝试使用下面的海关路径 driver.findElement(By.xpath(“[text()='账户']”)).click(); driver.findElement( By.xpath(“(//android.view.ViewGroup[text()='Account'])[1]/android.view.ViewGroup”)).click(); driver.findElement(By.xpath(“//android.widget.TextView[@text='Account']”)).click(); driver.findElement(By.xpath(“//*[android.widget[contains(text(),'Account')]]”)).click(); driver.findElement(By.xpath(“//android.widget.Button[@text='Account']”)).click();
答: 暂无答案
评论