web自动化测试与Appuim自动化测试对比
web自动化测试-打开浏览器:
1 from selenium import webdriver 2 driver = webdriver.Chrome() #定义chrome驱动 3 driver.maximize_window() #浏览器最大化 4 driver.get('http://www.baidu.com') #打开百度网址
Appuim自动化测试-打开一个APP:
1 from appium import webdriver 2 3 #Appium 服务器初始化参数 4 desired_cap = {} 5 desired_cap["automationName"] = "UiAutomator2" 6 desired_cap["platformName"] = "Android" 7 desired_cap["platformVersion"] = "5.1" 8 desired_cap["deviceName"] = "Android Emulator" 9 desired_cap["appPackage"] = "com.XX.XXX" #app包名 10 desired_cap["appActivity"] = "com.XX.XXX.activity.addition.WelcomeActivity" #app欢迎页 11 12 #连接appium server,并发送给它设备信息 13 driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_cap)