当前位置:网站首页>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
appPackage
andappActivity
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()
边栏推荐
- [commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial
- Texstudio tutorial
- TDengine 连接器上线 Google Data Studio 应用商店
- Logic is a good thing
- Go integrates logrus to realize log printing
- 8 best practices to protect your IAC security!
- Tdengine connector goes online Google Data Studio app store
- Journal MySQL
- 使用 Lambda 函数URL + CloudFront 实现S3镜像回源
- SWT / anr problem - how to capture performance trace
猜你喜欢
Scheme of printing statistical information in log
[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial
sqlilabs less13
sqlilabs less-11~12
[flask] flask starts and implements a minimal application based on flask
“国防七子”经费暴增,清华足足362亿元,甩第二名101亿 |全国高校2022预算大公开...
数据湖系列之一 | 你一定爱读的极简数据平台史,从数据仓库、数据湖到湖仓一体
What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!
sqlilabs less10
Liu Dui (fire line safety) - risk discovery in cloudy environment
随机推荐
[flask] flask starts and implements a minimal application based on flask
[Jianzhi offer] 54 The k-th node of binary search tree
sqlilabs less-8
Leetcode (69) -- square root of X
The integration of computing and Internet enables the transformation of the industry, and the mobile cloud lights up a new roadmap for the future of digital intelligence
[R language data science]: common evaluation indicators of machine learning
Go整合Logrus实现日志打印
建立自己的网站(21)
sqlilabs less9
Tdengine connector goes online Google Data Studio app store
Is the futures company found on Baidu safe? How do futures companies determine the regularity
Use lambda function URL + cloudfront to realize S3 image back to source
算网融合赋能行业转型,移动云点亮数智未来新路标
sqlilabs less-11~12
玩转gRPC—不同编程语言间通信
Provincial election + noi Part 10 probability statistics and polynomials
使用CMD修复和恢复病毒感染文件
SQLAchemy 常用操作
Research Report on the development trend and competitive strategy of the global electromagnetic flowmeter industry
【NLP】预训练模型——GPT1