the unittest Import
from the webdriver Selenium Import
class the F4 (of unittest.TestCase):
@classmethod
DEF setUpClass (CLS):
cls.driver = webdriver.Chrome ()
cls.driver.maximize_window ()
cls.driver.implicitly_wait (30)
cls.driver. GET ( "http://www.baidu.com")
@classmethod
DEF tearDownClass (CLS):
cls.driver.quit ()
"" "Baidu Home link test" ""
DEF test_baidu_del (Self):
"" "Home link testing: verify the news link "" "
self.driver.find_element_by_link_text (" News ") .click ()
self.driver.back ()
# first execution _add, then execute _del
DEF test_baidu_add (Self):
"" "Home Link Test: Verify link map." ""
self.driver.find_element_by_link_text("地图").click()
self.driver.back()
if __name__ == '__main__':
unittest.main(verbosity=2)
Method Unittest - performed sequentially with Example
Guess you like
Origin www.cnblogs.com/Teachertao/p/11183477.html
Recommended
Ranking