当前位置:网站首页>Details of appium key knowledge
Details of appium key knowledge
2022-07-01 14:17:00 【Wu Daxi】
One 、capability Instructions
Appium Official website configuration description
1、 Common part

2、Android alone possess

3、ios alone possess

4、 Common ways to obtain configuration information
- obtain
deviceName
adb devices

- obtain
appPackageandappActivity
adb shell
dumpsys activity | grep mFocusedActivity

Two 、appium How elements are positioned
1、 priority :
Generally, the order of selecting the location method is as follows id location >accessibility_id location >class location >xpath location >tap location .
2、 Positioning mode :
1、 adopt resource-id location
driver.find_element_by_id()


2、 adopt class_name location :class
driver.find_element_by_class_name()

3、 adopt accessibility_id location :content-desc
driver.find_element_by_accessibility_id()

4、 adopt xpath location
driver.find_element_by_xpath()

5、 adopt tap Simulate finger click positioning
Format :driver.tap()
Example :driver.tap([(60,138)],300) Pay attention to the format inside ( The first parameter is the list , In the list is Yuanzu )
explain : The first is positions, yes list Type up to five points ,duration It's duration , Unit millisecond
The tool below is SDK Self contained java Developed uiautomatorviewer, If you install it jdk, stay sdk Catalog \tools\bin Next Yes uiautomatorviewer.bat Double-click to open

6、uiautomator location 




7、toast location
Toast yes Android A mechanism for displaying information in , and Dialog The difference is ,Toast There is no focus , and Toast The display time is limited , It will disappear automatically after a certain time .

The first parameter : The current context . You can use getApplicationContext() perhaps getContext() or this.
The second parameter : String to display . But R.string Middle string ID.
The third parameter : The length of time displayed .Toast There are two by default LENGTH_LONG( Long 3.5 second ) and LENGTH_SHORT( short 2 second ), Milliseconds can also be used, such as 1000ms( Don't suggest ).
8、 other 
3、 ... and 、webview
1、webview brief introduction
We usually use a browser to browse the web , You know very well that you are using the browser , Or PC client , Or on the phone app. however webview Is an embedded browser , Embedded in native applications , You may not even realize you're using a browser .
2、 Environmental preparation

3、 How to judge whether a page is webview

4、 other


Four 、 Device interaction API
- Analog call :driver.make_gsm_call(‘13612312312’,GsmCallActions.CALL), Import required GsmCallActions library ;
- Simulated text messaging :driver.send_sms(‘13612312312’, ‘hello appium apis’)
- Simulate network settings :
Network settings category :driver.set_network_connection(connection_type: int)

- Screen capture operation :self.driver.get_screenshot_as_file(’./photos/img.png’)
- Record the screen of mobile phone :
Only support Android8.0 Above version , And some mobile phones, such as Huawei, do not support
self.driver.start_recording_screen()
self.driver.stop_recording_screen()
def test_mobile(self):
# Analog phone call
self.driver.make_gsm_call('13612312312', GsmCallActions.CALL)
# Simulated text messaging
self.driver.send_sms('13612312312', 'hello appium apis')
# Simulate network settings , Set to flight mode
self.driver.set_network_connection(1)
sleep(3)
# Simulate network settings , Set to data mode
self.driver.set_network_connection(4)
# Get the screenshot and save it to the path
self.driver.get_screenshot_as_file('./photos/img.png')
""" Carry out screen recording operation 1. Start recording 2. Stop recording 3. Only support Android8.0 Above version , And some mobile phones, such as Huawei, do not support """
self.driver.start_recording_screen()
self.driver.stop_recording_screen()
边栏推荐
- Distributed dynamic (collaborative) rendering / function runtime based on computing power driven, data and function collaboration
- 光環效應——誰說頭上有光的就算英雄
- 既不是研发顶尖高手,也不是销售大牛,为何偏偏获得 2 万 RMB 的首个涛思文化奖?
- Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance
- 如何看待国企纷纷卸载微软Office改用金山WPS?
- Leetcode (69) -- square root of X
- leetcode622.设计循环队列(C语言)
- Research Report on the development trend and competitive strategy of the global chemical glassware industry
- When the main process architecture game, to prevent calls everywhere to reduce coupling, how to open the interface to others to call?
- Play with mongodb - build a mongodb cluster
猜你喜欢

用栈实现队列、用队列实现栈(C语言_leetcode_232+225)

Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance

开源实习经验分享:openEuler软件包加固测试

App自动化测试开元平台Appium-runner

我们该如何保护自己的密码?

Use of Oracle database objects

Animesr: learnable degradation operator and new real world animation VSR dataset

被裁三個月,面試到處碰壁,心態已經開始崩了

Texstudio tutorial

清华章毓晋老师新书:2D视觉系统和图像技术(文末送5本)
随机推荐
This paper introduces an implementation scheme to enhance the favorite transaction code management tool in SAP GUI
深度合作 | 涛思数据携手长虹佳华为中国区客户提供 TDengine 强大企业级产品与完善服务保障
日志中打印统计信息的方案
Provincial election + noi Part 10 probability statistics and polynomials
那个很努力的学生,高考失败了……别慌!你还有一次逆袭机会!
Build your own website (21)
微服务大行其道的今天,Service Mesh是怎样一种存在?
[NLP] pre training model - gpt1
【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程
Phpcms realizes the direct Alipay payment function of orders
[anwangbei 2021] Rev WP
[R language data science]: common evaluation indicators of machine learning
Station B was scolded on the hot search..
原来程序员搞私活这么赚钱?真的太香了
Basis of target detection (NMS)
Effet halo - qui dit qu'il y a de la lumière sur la tête est un héros
sqlilabs less-8
QT community management system
Basic operation of queue (implemented in C language)
Texstudio tutorial