当前位置:网站首页>Detailed explanation of equipment interaction API for dry goods 𞓜 app automated testing

Detailed explanation of equipment interaction API for dry goods 𞓜 app automated testing

2022-06-10 01:49:00 Hua Weiyun

Appium Provides a lot of system operation , In the test APP There will be some special scenes in the process , Like a phone call 、 SMS , Horizontal and vertical screen switching , install / uninstall APP, Keyboard operation on mobile phone , Screen recording and other functions . Here are some common device interactions API.
See the official website for more usage :
http://appium.io/docs/en/about-appium/intro/

Analog phone / SMS

Use the following command to simulate GSM Phone calls and text messages , Be careful : Can only be used on simulators !

self.driver.make_gsm_call("5551234567", GsmCallActions.CALL);self.driver.send_sms('555-123-4567', 'Hey lol')

App operation

#  Realization  APP  Installation self.driver.install_app('/Users/johndoe/path/to/app.apk') #  testing  APP  Is it installed self.driver.is_app_installed('com.example.AppName');#  start-up  APPself.driver.launch_app()

weditor Installation mode

Keyboard events can be referenced Android Official website :
https://developer.android.com/reference/android/view/KeyEvent.html
The keys are shown below 、 Long press 、 Hidden keyboard 、 Whether the soft keyboard displays , The code is as follows :

self.driver.press_keycode(10)self.driver.long_press_keycode(10)self.driver.hide_keyboard()self.driver.is_keyboard_shown()

Set the contents of the system clipboard :

self.driver.set_clipboard('happy testing')self.driver.set_clipboard_text('happy testing')

Get the contents of the clipboard :

self.driver.get_clipboard()self.driver.get_clipboard_text()

Device interaction API Let's start with this , If you want to learn about other device interactions API Or other knowledge points , You can leave a message below !

More technical dry goods articles :https://qrcode.ceba.ceshiren.com/link?name=article&project_id=qrcode&from=hwyun&timestamp=1654151969&author=BB

Friends who like software testing , If my blog helps you 、 If you like my blog content , please “ give the thumbs-up ” “ Comment on ” “ Collection ” One button, three links !

原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091603063213.html