web自动化测试-打开浏览器:

 from selenium import webdriver
driver = webdriver.Chrome() #定义chrome驱动
driver.maximize_window() #浏览器最大化
driver.get('http://www.baidu.com') #打开百度网址

Appuim自动化测试-打开一个APP:

 from appium import webdriver

 #Appium 服务器初始化参数
desired_cap = {}
desired_cap["automationName"] = "UiAutomator2"
desired_cap["platformName"] = "Android"
desired_cap["platformVersion"] = "5.1"
desired_cap["deviceName"] = "Android Emulator"
desired_cap["appPackage"] = "com.XX.XXX" #app包名
desired_cap["appActivity"] = "com.XX.XXX.activity.addition.WelcomeActivity" #app欢迎页 #连接appium server,并发送给它设备信息
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_cap)
05-11 16:23