Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the element positioning of appium?

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I would like to talk to you about what the element positioning of appium is, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

The following is a brief introduction to how to locate an element from the tool introduction and positioning strategy.

Introduction to common tools

Tool support platform description

The appium-inspector android,iOS native official appium-desktop installation package comes with it, which is not available on the command line installation.

App-inspector android,iOS native Ali's open source macaca framework comes with tools that can be installed separately:

Npm install-g app-inspector

UIAutomatorviewer android native android sdk comes with tools and software.

Chrome Inspect android,iOS webview android webview can be used directly, iOS webview needs to install ios-webkit-debug-proxy

And start using ios_webkit_debug_proxy-f chrome-devtools://devtools/bundled/inspector.html

Common positioning strategies

General positioning strategy (applicable to the whole platform):

FindElement (s) ByName

FindElementById

FindElement (s) ByClassName

FindElement (s) ByXPath

The above four are very basic positioning strategies without much introduction, among which the positioning of XPath is a little more complicated. Readers can familiarize themselves with the syntax of xpath, which will be of great help.

Android unique positioning strategy:

FindElement (s) ByAndroidUIAutomator

This positioning method is actually transformed through the UISelector positioning mode of the UIautomator framework. If you are familiar with UISelector, this is very simple to understand.

Introduce several simple UISelector positioning methods, new UiSelector.resourceId (), new UISelector.text, new UISelector.className ()

E.g:

Driver.findElementByAndroidUIAutomator ("new UiSelector () .className (\" android.widget.ImageView\ ") .clickable (true)")

Driver.findElementByAndroidUIAutomator ("new UiScrollable (new UiSelector (). Scrollable (true)) .scrollIntoView (new UiSelector (). TextContains (\" Test\ ")"))

one

two

IOS unique positioning strategy:

FindElement (s) ByIosUIAutomation, valid only when using the UIAutomation framework

FindElement (s) ByIosNsPredicate, valid only when using the XCUItest framework, is a natively supported positioning strategy

Locate through an attribute or multiple attributes of an element. The attributes of an element include type, value, name, label, enabled, visible

The basic format of element positioning is: attribute + operator + value form.

Operators have comparison operators >, =

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report