代码拉取完成,页面将自动刷新
from appium import webdriver
# from selenium.webdriver.common.by import By
from appium.webdriver import WebElement
from appium.webdriver.common.mobileby import MobileBy
from time import sleep
import random
# desired_caps={
# "automationName": "UiAutomator2",
# "platformName": "Android",
# "platformVersion": "6.0",
# "deviceName": "Custom Phone",
# "appPackage": "com.android.calculator2",
# "appActivity": ".Calculator",
# "unicodeKeyboard":True,# 支持中文输入,默认false
# "resetKeyboard":True,# 重置输入法为系统默认,将键盘给隐藏起来
# "noReset": True, # 不重新安装apk
# "noSign": True # 不重新签名apk
# }
desired_caps={
"automationName":"UiAutomator2",
"platformName": "Android",
"platformVersion": "8.0",
"deviceName": "Custom Phone",
"appPackage": "com.android.calculator2",
"appActivity": ".Calculator",
"unicodeKeyboard":True,# 支持中文输入,默认false
"resetKeyboard":True,# 重置输入法为系统默认,将键盘给隐藏起来
"noReset": True, # 不重新安装apk
"noSign": True # 不重新签名apk
}
driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
n8 = driver.find_element_by_id("com.android.calculator2:id/digit_8")
n8.click()
elplus = driver.find_element_by_accessibility_id("加")
elplus.click()
n1 = driver.find_element_by_id("com.android.calculator2:id/digit_1")
n1.click()
driver.find_element(MobileBy.ACCESSIBILITY_ID,"等于").click()
sleep(3)
driver.quit()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。