基于Selenium的web自动化框架(10)
发表于:2016-11-23来源:测试改进工场作者:测试改进工场点击数:
标签:框架
# Step2: Open Login page login_page = LoginPage(self.driver) # Step3: Enter username password LogUtility.Log( Login web using username ) login_page.set_username( username ) login_page.set_password( pa
#Step2: Open Login page
login_page =
LoginPage(self.driver)
#Step3: Enter username & password
LogUtility.Log(
"Login web using username")
login_page.set_username("username")
login_page.set_password("password")
time.sleep(2
)
#Checkpoint1: Check popup dialog title
LogUtility.Log(
"Check whether sign in dialog exists or not")
self.assertEqual(login_page.get_DiaglogTitle(),"Sign in")
#time.sleep(3)
#Step4: Cancel dialog
login_page.click_cancel()
self.testCaseInfo.result =
"Pass"
except Exception as err:
self.testCaseInfo.errorinfo =
str(err)
LogUtility.Log(("Got error: "+
str(err)))
finally:
self.testCaseInfo.endtime =
cc.getCurrentTime()
self.testCaseInfo.secondsDuration =
cc.timeDiff(self.testCaseInfo.starttime,self.testCaseInfo.endtime)
def tearDown(self):
self.driver.close()
self.testResult.WriteHTML(self.testCaseInfo)
if __name__ ==
'__main__':
unittest.main()