1. Open Appium Run
2. Enter the code in the Pycharm as follows:
From appium import webdriverdesired_caps = {} #初始化desired_caps [' platformname '] = ' Android ' #使用哪种移动平台desired_ caps[' platformversion ' = ' 6.0 ' # android version desired_caps[' devicename '] = ' Android Emulator ' # What kind of device is enabled Desired_ caps[' apppackage ' = ' com.android.calculator2 ' desired_caps[' appactivity '] = '. Calculator ' Driver = webdriver. Remote (' Http://localhost:4723/wd/hub ', desired_caps) # initializes the Driver.find_element_by_name ("1"). Click () Driver.find_element_by_name ("+"). Click () driver.find_element_by_name ("6"). Click () driver.find_element_by_name ("= "). Click () driver.quit ()
3. Successful operation: The simulator automatically opens the calculator, calculates, exits
2. Running a successful demo (Python+appium)