Configuration
from appium import webdriver desired_caps={} desired_caps['platformName']='Android' #模拟器 desired_caps['deviceName']='127.0.0.1:62001' desired_caps['platforVersion']='5.1.1' desired_caps['app']=r'F:\App\3.1.0.apk' desired_caps['appPackage']='com.tal' desired_caps['appActivity']='com.activity.SplashActivity'
# Is not written as False (does not retain the user's session, each time updating and skipped tips) # corresponds to reinstall every time desired_caps [ ' NoReset ' ] = ' True '
send_keys () # needs to be configured in a following capability when the incoming Chinese desired_caps [ ' unicodeKeyboard ' ] = ' True ' desired_caps [ ' resetKeyboard ' ] = ' True '
If you do not add these two lines, when he can not have Chinese input
Sometimes the addition of these two lines, garbled input Chinese, the reason is because the input method
After using appium do input operation, if the input method appears not to arouse, can be replaced in the system setup --- --- language and input current input to the system input method or other input methods
Appium1.6.3 began to support the identification Toast content, mainly based uiAutomator2, you need to configure the following parameters Capability, first installation, installation steps to view the contents inside the toast of appium2
desired_caps['automationName']='uiautomator2'
driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
Start appium Service
You can enter appium in cmd to start, do not start the appium-desktop
Real
from appium import webdriver desired_caps={} desired_caps['platformName']='Android' #模拟器 desired_caps['deviceName']='127.0.0.1:62001' desired_caps['platforVersion']='5.1.1' #真机 # desired_caps['deviceName']='ry' # desired_caps['platforVersion']='7.0' # desired_caps['udid']='KVXBB18224502326' desired_caps['app']=r'F:\App\1.0.apk' desired_caps['appPackage']='xxx' desired_caps['appActivity']='xxx' driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
/ Wd / hub provision write, because the source code written this way, you can see Remote source, 4723 to appium-desktop port
Error resolved
urllib.error.URLError: <urlopen error [WinError 10061 ] Since the target computer actively refused, unable to connect. >
Solution: The service is not open, open appium