赞
踩
- from appium import webdriver
- from appium.webdriver.common.touch_action import TouchAction
- desired_capacity = {}
-
- desired_capacity["platformName"] = "Android"
- desired_capacity["deviceName"] = "JVGUOVCA9H5PEEDI"
- desired_capacity["platformVersion"] = "6.0"
- desired_capacity["appPackage"] = "com.tencent.mm"
- desired_capacity["appActivity"] = "com.tencent.mm.ui.LauncherUI"
- desired_capacity["noReset"] = True
- driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_capacity)
- driver.implicitly_wait(10)
-
- me_ele = driver.find_elements_by_id("com.tencent.mm:id/ddk")[3]
-
- TouchAction(driver).tap(me_ele).perform()
-
- pay_ele = driver.find_elements_by_id("com.tencent.mm:id/a0c")[0]
-
- TouchAction(driver).tap(pay_ele).perform()
-

desired_capacity["noReset"] = True 表示会话保留,即当app登录之后,appium就不会再去重新登录了。
desired_capacity["deviceName"] = "JVGUOVCA9H5PEEDI" 使用adb devices可以查看deviceName。
adb connect 62001 连接手机或模拟器的端口号。
- from selenium import webdriver
- options = webdriver.ChromeOptions()
- options.add_argument('lang=zh_CN.UTF-8')
- options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"')
- driver = webdriver.Chrome(chrome_options = options)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。