First, the equipment configuration information
Script is as follows:
. 1 from appium Import the webdriver 2 . 3 class my_app (): . 4 DEF the __init__ (Self): . 5 desired_caps = {} . 6 # phone or the operating system used by the simulator . 7 desired_caps [ " PlatformName " ] = " the Android " . 8 . 9 # == Honor V9 ============== ====== 10 # system version . 11 desired_caps [ " platformVersion " ] = " . 9 " 12 is # 使用的手机名称 13 desired_caps["deviceName"] = "Honor V9 " 14 desired_caps['udid'] = "6EBDU17320000355" 15 # ======== honor V9 ============== 16 17 # ======== OPPO R17============== 18 # desired_caps['platformVersion'] = '8.1.0' 19 # desired_caps['deviceName'] = 'oppo R17' 20 # desired_caps['udid'] = 'd85b705f' ======== OPPO R17 ==============#21 22 is 23 is # ======== ============== the Android emulator 24 # System Version 25 # desired_caps [ "platformVersion"] = "5.1.1" 26 is # used simulator type 27 # desired_caps [ "deviceName"] = "the Android emulator" 28 # to install the app path 29 # desired_caps [ "app"] = "D: \ lemon_app_webview_debug.apk" 30 # ======== ============== Android emulator 31 is 32 # application package name 33 is desired_caps [ " appPackage " ] = " com.fangdd.mobile.realtor" 34 # The Activity 35 desired_caps [ " appActivity " ] = " com.fangdd.mobile.realtor.common.splash.activity.FddSplashActivity " 36 # Print (desired_caps) 37 [ # connect with appium server, and transmits the information to operate the device 38 is Self = webdriver.Remote .driver ( " http://127.0.0.1:4723/wd/hub " , desired_caps)
Note : The above Android7.0 version requires more than appium1.6.3 version is supported, you can download two appium version on your computer, coexistence, can be use for different Android versions; appium1.6 above are based on appium-desktop version named
Second, the script interpreter:
- platformName: phone or emulator system
- platformVersion: System Version
- deviceName: device name,
- udid: device number, enter the command line adb devices to view,
- app: To install the app path
- noReset: False (default) to reset the application, every time you open will enter the welcome page. True: do not reset the application, enter only the first time you open the welcome page