程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python automated test 34] appium element positioning

編輯:Python

List of articles

  • One 、 Preface
  • Two 、Appium Element positioning tools
  • 3、 ... and 、App Element positioning and Web Element positioning is different
  • Four 、 How elements are positioned

One 、 Preface

This article mainly explains App Element positioning of automated testing , In addition, there is a portal for a series of articles below , It's still being updated , Interested partners can also go to check , Don't talk much , Let's have a look ~

Series articles :
Series articles 1:【Python automated testing 1】 meet Python The beauty of the
Series articles 2:【Python automated testing 2】Python Installation configuration and PyCharm Basic use
Series articles 3:【Python automated testing 3】 First knowledge of data types and basic syntax
Series articles 4:【Python automated testing 4】 Summary of string knowledge
Series articles 5:【Python automated testing 5】 List and tuple knowledge summary
Series articles 6:【Python automated testing 6】 Dictionary and collective knowledge summary
Series articles 7:【Python automated testing 7】 Data operator knowledge collection
Series articles 8:【Python automated testing 8】 Explanation of process control statement
Series articles 9:【Python automated testing 9】 Function knowledge collection
Series articles 10:【Python automated testing 10】 File basic operation
Series articles 11:【Python automated testing 11】 modular 、 Package and path knowledge collection
Series articles 12:【Python automated testing 12】 Knowledge collection of exception handling mechanism
Series articles 13:【Python automated testing 13】 class 、 object 、 Collection of attribute and method knowledge
Series articles 14:【Python automated testing 14】Python Basic and advanced exercises of automatic test
Series articles 15:【Python automated testing 15】unittest The core concept and function of test framework
Series articles 16:【Python automated testing 16】 Test case data separation
Series articles 17:【Python automated testing 17】openpyxl Secondary packaging and data driven
Series articles 18:【Python automated testing 18】 Configuration file analysis and practical application
Series articles 19:【Python automated testing 19】 Log system logging Explain
Series articles 20:【Python automated testing 20】 Construction of interface automation test framework model
Series articles 21:【Python automated testing 21】 Interface automation test practice 1 _ Interface concept 、 Project introduction and test process Q & A
Series articles 22:【Python automated testing 22】 Interface automation test practice II _ Interface framework modification and use case optimization
Series articles 23:【Python automated testing 23】 Interface automation test practice III _ Dynamic parameterization and data forgery
Series articles 24:【Python automated testing 24】 Interface automation test practice IV _Python Operating the database
Series articles 25:【Python automated testing 25】 Interface automation test practice 5 _ Database assertion 、 Interface Association and related management optimization
Series articles 26:【Python automated testing 26】 Interface automation test practice 6 _pytest frame +allure Explain
Series articles 27:【Python automated testing 27】Web Automated testing theory 、 Environment construction and common operations
Series articles 28:【Python automated testing 28】html Basic grammar
Series articles 29:【Python automated testing 29】Xpath、 Axis operation and CSS Detailed explanation of element positioning
Series articles 30:【Python automated testing 30】Web The three waiting and switching of automation
Series articles 31:【Python automated testing 31】Web Automatic mouse and keyboard operation 、select usage
Series articles 32:【Python automated testing 32】App Automation environment construction
Series articles 33:【Python automated testing 33】Appium Start up steps 、 Initialization operation and Appium principle

Two 、Appium Element positioning tools

Appium and selenium Similarly, element positioning is also required , To perform specific operations , but Web Element positioning can be done through F12 For element viewing , and App Software cannot pass F12 For element viewing , We need some tools to view elements :
(1)weditor ( recommend )
(2)appium inspect
(3)android uiautomatorviewer

The author suggests that weditor, It will be easier to use , The specific way is not demonstrated here , You can go through pip install weditor Installation , The specific operation can be viewed by Baidu , Actual element positioning and execution selenium Very similar , But elaborate more , Here are the recommended tools , In the follow-up, the author will add details and tool use when he has free time .

but weditor There are some pits , There may not be , The author lists here , Prevent everyone from stepping on thunder :
1、weditor Our service meeting and appium Conflict , Solution :
(1) Don't start first appium,weditor Locate and copy the elements you need
(2) uninstall appium The car in the , The name is :atx, After uninstalling, you can start appium 了

3、 ... and 、App Element positioning and Web Element positioning is different

The general differences are as follows :
1、 The results page :web from html To write , The Android page is made up of xml To write .
2、 Page properties : The attribute names of all elements are fixed , Only the values are different
3、app Of id It's not the only one , Therefore, it cannot act on the unique identification .
4、text Attribute , use @text Express

Four 、 How elements are positioned

App Element positioning and Web similar , It can also be done through xpath、id、class name And so on , But I only recommend xpath,App The elements within are positioned relative to Web It's more complicated ,Xpath Your positioning will be more accurate , It's more convenient , In addition, through id To locate , It is also generally used for combined positioning , in addition to , Other methods are not recommended , Therefore, there is no excessive enumeration in this article , It will be supplemented in the subsequent free time .



Api The use of will be listed later , It is recommended to refer to the official website


All right. ~ The above is all the content shared in this article , Have you learned ? I hope I can help you !



  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved