Appium_测试步骤读取自外部文件:定制执行引擎
class TestCase: def __init__(self,path): file = open(path,"r") self.steps = yaml.safe_load(file) def run(self,driver:WebDriver): for step in self.steps: element = None if isinstance(step,dict): if "id" in step.keys(): element = driver.find_element_by_id(step["id"]) elif "xpath" in step.keys(): element = driver.find_element_by_xpath(step["xpath"]) else: print(step.keys()) if "input" in step.keys(): element.send_keys(step["input"]) elif "get" in step.keys(): element.get_attribute(step["get"]) else: element.click()
参考内容:
相关推荐
歆萌 2020-08-03
xjp 2020-08-03
lucialee 2020-07-18
歆萌 2020-07-05
maowenbei 2020-07-04
QCkiss 2020-06-21
无缘公子 2020-06-18
xhpscdx 2020-06-16
freerocker 2020-06-16
ZoctopusD 2020-06-14
lucialee 2020-06-13
freerocker 2020-06-12
xhpscdx 2020-06-12
RocketJ 2020-06-11
chichichi0 2020-06-10
Dipa 2020-06-09
dangai00 2020-06-06