6-3-3ios自动化-数据驱动
2024-09-28 22:33:26
https://testerhome.com/topics/14247
#!/usr/bin/env python3
# coding:utf-8
from appium import webdriver
import time,selenium,openpyxl,unittest
class testCheat(unittest.TestCase):
def setUp(self):
self.wb=openpyxl.load_workbook("ms.xlsx",data_only=True)
self.wb.guess_types=True
self.sh=self.wb['工作表 1']
self.caps={}
self.caps['bundleId']='com.taobaobj.moneyshield'
self.caps['newCommandTimeout']=600
self.driver=webdriver.Remote("http://192.168.43.86:8100/wd/hub",self.caps)
time.sleep(5)
def find_element(self,xpath,timeout=30):
deadline=time.time()+timeout
while time.time() < deadline:
try:
el=self.driver.find_element_by_xpath(xpath)
return el
except Exception as e:
time.sleep(0.5)
raise RuntimeError("Element not found ")
def test_ch(self):
for row in self.sh.rows:
if row[3].value not in ['yes',]:
continue
print(row[0].value,row[1].value)
op=row[0].value
xpath=row[1].value
if op =='click':
self.find_element(xpath).click()
if op == 'assert':
self.find_element(xpath)
if op=='send_keys':
self.find_element(xpath).send_keys(row[4].value)
def tearDown(self):
self.driver.quit()
if __name__=='__main__':
unittest.main()
excel表格
最新文章
- java中判断字符串是否为只包含数字
- [译]Godot系列教程一 - 场景与节点
- 推荐一个iOS关于颜色的库-Wonderful
- uboot补丁的分析
- CF453B Little Pony and Harmony Chest (状压DP)
- 未能找到类型或命名空间名称“Coco”(是否缺少 using 指令或程序集引用)
- mysql中的unique
- sql server Convert 的函数的用法 转换成浮点数
- pip安装lxml报错
- PHP 导入excel
- 纯C语言INI文件解析
- clip实现圆环进度条
- for /r命令实现全盘搜索指定文件
- kafka知识体系-kafka设计和原理分析-kafka文件存储机制
- iOS键盘事件实现、控制
- 数据库索引的数据结构b+树
- Python 3 iter函数用法简述
- 10个提升MySQL性能的小技巧
- 机器学习使用sklearn进行模型训练、预测和评价
- LeetCode 349 Intersection of Two Arrays 解题报告
热门文章
- Sqoop2安装
- ES Log4J配置信息
- centos7下Redis-Sentinel安装和配置
- Tomcat学习之二:tomcat安装、配置及目录文件说明
- 用于主题检测的临时日志(0ece3f5c-d74f-449c-85a7-ed53fffb0e94 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)
- Ubuntu忘记root密码的解决方法
- URAL - 1397:Points Game (博弈,贪心)
- kafka日志同步至elasticsearch和kibana展示
- 【C#】 增加多个分部类
- 【java规则引擎】《Drools7.0.0.Final规则引擎教程》第4章 4.2 agenda-group