• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 基于Selenium的web自動化框架(4)

    發表于:2016-11-23來源:測試改進工場作者:測試改進工場點擊數: 標簽:框架
    ) cancelButton = (By.XPATH, //button[@class=\btn btn-warning ng-binding\][@ng-click=\cancel()\] ) okButton = (By.XPATH, //button[@class=\btn btn-primary ng-binding\][@ng-click=\ok()\] ) # Get username
    ) cancelButton = (By.XPATH,'//button[@class=\"btn btn-warning ng-binding\"][@ng-click=\"cancel()\"]') okButton = (By.XPATH,'//button[@class=\"btn btn-primary ng-binding\"][@ng-click=\"ok()\"]') #Get username textbox and input username def set_username(self,username): name = self.driver.find_element(*LoginPage.usename) name.send_keys(username) #Get password textbox and input password, then hit return def set_password(self, password): pwd = self.driver.find_element(*LoginPage.password) pwd.send_keys(password + Keys.RETURN) #Get pop up dialog title def get_DiaglogTitle(self): digTitle = self.driver.find_element(*LoginPage.dialogTitle) return digTitle.text #Get "cancel" button and then click def click_cancel(self): cancelbtn = self.driver.find_element(*LoginPage.cancelButton) cancelbtn.click() #click Sign in def click_SignIn(self): okbtn = self.driver.find_element(*LoginPage.okButton) okbtn.click()
    復制代碼

     

     

    采用頁面模式來管理頁面和測試用例有很多好處,主要體現在:

    • 簡單并且清晰

    每個頁面都有單獨的類來封裝頁面元素和操作,讓頁面操作更加具體化,而不是相對獨立的。

    比如未使用頁面模式,測試用例的輸入用戶名和密碼的代碼:

    原文轉自:http://www.cnblogs.com/AlwinXu/p/5836709.html

    ...

    熱門標簽

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>