Appium_测试步骤读取自外部文件(定制执行引擎)

【Appium_测试步骤读取自外部文件(定制执行引擎)】学向勤中得,萤窗万卷书。这篇文章主要讲述Appium_测试步骤读取自外部文件:定制执行引擎相关的知识,希望能为你提供帮助。

1 class TestCase: 2def __init__(self,path): 3file = open(path,"r") 4self.steps = yaml.safe_load(file) 5 6def run(self,driver:WebDriver): 7for step in self.steps: 8element = None 9if isinstance(step,dict): 10if "id" in step.keys(): 11element = driver.find_element_by_id(step["id"]) 12elif "xpath" in step.keys(): 13element = driver.find_element_by_xpath(step["xpath"]) 14else: 15print(step.keys()) 16if "input" in step.keys(): 17element.send_keys(step["input"]) 18elif "get" in step.keys(): 19element.get_attribute(step["get"]) 20else: 21element.click()

 
参考内容:
1.  https://www.bilibili.com/video/av79004717?p=26

    推荐阅读