appium小笔记

from appium import webdriver

caps = {
"platformName": "Android",
"platformVersion": "5.1.1",
"deviceName": "127.0.0.1:62025",
"appPackage": "com.lqr.wechat",
"appActivity": "com.lqr.wechat.ui.activity.SplashActivity"
}

driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)

driver.find_element_by_id("com.lqr.wechat:id/btnLogin").click()

driver.find_element_by_id("com.lqr.wechat:id/etPhone").send_keys("18010181267")
driver.find_element_by_id("com.lqr.wechat:id/etPwd").send_keys("123456")
driver.find_element_by_id("com.lqr.wechat:id/btnLogin").click()

driver.quit()


from appium import webdriver
from time import sleep


# 启动配置
caps = {
"platformName": "Android",
"platformVersion": "5.1.1",
"deviceName": "127.0.0.1:62001",
"appPackage": "com.android.androidui",
"appActivity": "com.android.androidui.MainActivity"
}

driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘, caps)
# driver.find_element_by_xpath("//*[@text=‘Android Switch 关闭‘]")
driver.find_element_by_id(‘com.android.androidui:id/mySwitch‘).click()
driver.find_element_by_id(‘com.android.androidui:id/buttonAlert‘).click()
driver.find_element_by_xpath(‘//*[@text="Yes"]‘)

driver.quit()

from appium import webdriver

caps = {
"platformName": "Android",
"platformVersion": "5.1.1",
"deviceName": "127.0.0.1:62025",
"app": r"D:\16期\day09\app-debug.apk"
}

driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)

driver.find_element_by_id("com.lqr.wechat:id/btnLogin").click()

driver.find_element_by_id("com.lqr.wechat:id/etPhone").send_keys("18010181267")
driver.find_element_by_id("com.lqr.wechat:id/etPwd").send_keys("123456")
driver.find_element_by_id("com.lqr.wechat:id/btnLogin").click()

driver.quit()

appium小笔记

上一篇:axios学习笔记


下一篇:在SAP除了使用Cordova生产移动应用外,还有这种方式