Appium 服务器初始化参数

具体看这个网址里:有通用的如platformName等,还有安卓和ios设备特有的一些参数

http://appium.io/docs/cn/writing-running-appium/caps/

from appium import webdriver

# 用字典来存储appium服务器的启动参数
desired_caps = {}
desired_caps["platformName"] = "Android"
desired_caps["platformVersion"] = "8.0"  # 不知道版本号的时候可以先写,然后看报错
desired_caps["deviceName"] = "xiaomi"  # 在Andorid 上虽然这个参数目前已被忽略,但仍然需要添加上该参数
desired_caps["appPackage"] = ""  # android自动化必要参数
desired_caps["appActivity"] = ""  # android自动化必要参数
desired_caps["noReset"] = True  # 不重置手机



# 与appium进行连接,init方法中的端口号是4444,所以这里要改成4723;并且把启动参数传入
webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)

app中内嵌webview页面的时候,chromdriver的版本可能导致运行失败,有2种解决办法

1、启动参数中加入

desired_caps["chromedriverExecutable"] ="chromdriver路径 例如D://xx//chromedriver.exe"

2、appium中添加chromedriver的路径

原文地址:https://www.cnblogs.com/erchun/p/13376466.html