Appium + Python Test A simple script for QQ Music app

Source: Internet
Author: User
Tags python script appium

1. Approximate process
+  程序(Python):打开 QQ 音乐,点击一系列接收按键,进入搜索音乐界面,输入『Paradise』,播放第一首音乐。
2. The Python script is as follows
From appium import Webdriverimport timedesired_caps = {}desired_caps[' platformname '] = ' Android ' # adb shell Getprop Ro.bu Ild.version.release get version number desired_caps[' platformversion '] = ' 6.0 ' desired_caps[' devicename '] = ' Android Emulator ' Desir ed_caps[' apppackage ' = ' com.tencent.qqmusic ' # adb shell Dumpsys Activity Activities | grep "Realactivity" obtains appactivitydesired_caps[' appactivity '] = '. Activity. Appstarteractivity ' Driver = webdriver. Remote (' Http://localhost:4723/wd/hub ', Desired_caps) # A series of Click # Page1 sddriver.find_element_by_id (' Com.tencent.qqmusic:id/y3 '). Click () time.sleep (1) # Page2 telephone Com.android.packageinstaller:id/permission_allow_ buttondriver.find_element_by_id (' Com.android.packageinstaller:id/permission_allow_button '). Click () # Driver.findelementbyxpath ("//android.widget.button[@text = ' Always Allow ']"). Click (); Time.sleep (1) # Page3driver.find_  element_by_id (' Com.android.packageinstaller:id/permission_allow_button '). Click () time.sleep (1) # Page4 Com.tencent.qqmusic:id/v3 Skip Driver.find_element_by_id (' Com.tencent.qqmusic:id/v3 '). Click () time.sleep (1) # Page5 Cancel login driver.find_element_by_id (' Com.tencent.qqmusic:id/lh '). Click () time.sleep (1) # PAGE6 Click Shrink driver.find_element_by_id (' Com.tencent.qqmusic:id/ T3 '). Click () time.sleep (1) # Page7 driver.find_element_by_id (' com.tencent.qqmusic:id/a7j '). Click () Search_box = driver.find_element_by_id (' com.tencent.qqmusic:id/a7j ') Search_box.click () Search_box.send_keys (' Paradise ') # Enter the name of the retrieved song, does not support Chinese (like? ) Time.sleep (2) # com.tencent.qqmusic:id/cb3driver.find_element_by_id (' com.tencent.qqmusic:id/cb3 '). Click () Time.sleep (1) # com.tencent.qqmusic:id/a55driver.find_element_by_id (' Com.tencent.qqmusic:id/a55 '). Click () Time.sleep (1)
3. Program running Video (recording screen)
    • Run mobile phone recorder, click to watch

Appium + Python Test A simple script for QQ Music app

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.