Appium TestNG-如何识别其他语言的元素 [英] Appium TestNG - How to identify an element in other languages

查看:92
本文介绍了Appium TestNG-如何识别其他语言的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在实际设备中使用Appium/TestNG来使应用程序自动化,但是某些元素在其他语言中具有[@ text ='string'].在其他语言上使用相同代码而不是为每种语言创建一个代码的最佳解决方案是什么?

解决方案

最佳做法是永远不要使用//*[@text='string']

之类的XPath定位器.

对于 Android 应用,请使用resource-iduiautomator定位器策略

对于 iOS 应用accessibility-idios class chain定位器策略

这将有助于保持测试的稳定性和合理的速度

i´m using Appium/TestNG in real devices to automate an application, but some elements have the [@text='string'] with other languages. what´s the best solution to use the same code on other languages instead of creating one code for each language ?

解决方案

Best practice is to never use XPath locators like //*[@text='string']

For Android apps use resource-id or uiautomator locator strategies

For iOS apps accessibility-id or ios class chain locator strategies

It will help to keep your tests stable and reasonably fast

这篇关于Appium TestNG-如何识别其他语言的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆