Java – replace name locator policy in appium version > = 1.5.0

I am using Java and appium to write mobile app automation test cases for Android / IOS

I have upgraded my appium version from 1.4.16 to 1.5.3. Now, I can't use the name locator

Name locator:-

By.name("name here")

Remove the deprecated name locator policy in appium v1.5

I've tried the findelementbyaccessibilityid locator. But it doesn't help me

driver.findElementByAccessibilityId("name");

For reference only, I don't have a specific ID or class to use it. What is an alternative to a name locator?

resolvent:

Using wildcards with XPath may be very slow because it will scan the entire tree. If there are multiple items with the same name, it is also easy to return wrong elements. Use the exact locator as much as possible. Example: by. XPath ("/ / uiabutton [@ name = 'foo'])

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>