TA的每日心情 | 无聊 14 小时前 |
---|
签到天数: 531 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
我在运行过程中,没有报错,运行结果却是一串数字
如图:
#源码如下:
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.wait import WebDriverWait
- from appium.webdriver.common.touch_action import TouchAction
- byDict = {
- "xpath": By.XPATH,
- "id": By.ID,
- }
- class Action:
- new_desired_caps = {}
- @property
- def url(self):
- return self.new_url
- @url.setter
- def url(self, ip):
- self.new_url = 'http://{ip}:4723/wd/hub'.format(ip=ip)
- @property
- def driver(self):
- return self.new_driver
- @driver.setter
- def driver(self, driver):
- self.new_driver = driver
- self.new_touch = TouchAction(self.new_driver)
- @property
- def touch(self):
- return self.new_touch
- @property
- def desired_caps(self):
- return self.new_desired_caps
- @desired_caps.setter
- def desired_caps(self, desired_caps):
- self.new_desired_caps = desired_caps
- def find_ele(self, loc):
- print(loc.split("=>")[0],loc.split("=>")[1])
- element = WebDriverWait(self.driver, 30).until(
- lambda x: x.find_element(byDict[loc.split("=>")[0]], loc.split("=>")[1]))
- print(element)
- return element
- def click_key(self, loc):
- self.find_ele(loc).click()
- if __name__ == '__main__':
- # a = Action()
- b = eval('10*(1-10*0.01)*908.35*0.0001')
- print(b)
- #运行程序:
- appconfig = (5,'com.android.contacts','com.android.contacts.activities.DialtactsActivity',1,1,1,"{'androidProcess': 'com.tencent.mm:tools'}",1, 'CUN-AL00')
- phone = (8, 'myphone', 'CUN-AL00', 'Android', 'CYSBBBE710517072', '5.1')
- print(appconfig)
- print(phone)
- import sys
- sys.path.insert(0,"D:\\Python\\source\\python_call")
- from action import Action
- from appium import webdriver
- action = Action()
- # 相关配置
- action.desired_caps['platformName'] = 'Android' # 平台
- action.desired_caps['platformVersion'] = '5.1' # Android版本
- action.desired_caps['deviceName'] = 'CYSBBBE710517072' # 设备号
- action.desired_caps['appPackage'] = 'com.android.contacts' # 包名
- action.desired_caps['appActivity'] = 'com.android.contacts.activities.DialtactsActivity' # 启动页
- action.desired_caps['unicodeKeyboard'] = True # 使用unicode编码方式发送字符串
- action.desired_caps['resetKeyboard'] = True # 将键盘隐藏起来,默认true
- action.desired_caps['noReset'] = True # 应用状态是否需要重置,默认true
- action.desired_caps['automationName'] = 'Uiautomator2' # 自动化引擎,兼容原生和H5
- # 控制远程appium
- action.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", action.desired_caps)
- # 点击事件
- action.click_key("id=>one")
- action.click_key("id=>five")
- action.click_key("id=>two")
- action.click_key("id=>three")
- action.click_key("id=>six")
- action.click_key("id=>two")
- action.click_key("id=>eight")
- action.click_key("id=>eight")
- action.click_key("id=>eight")
- action.click_key("id=>star")
- action.click_key("id=>star")
- action.click_key("id=>dctv_call")
复制代码
|
|