基于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()