python3+selenium 牛刀小试
1 # coding:utf-8 2 # __author__ = 'Carry' 3 4 import unittest 5 from selenium import webdriver 6 import time 7 8 class Test_bokeyuan(unittest.TestCase): 9 10 @classmethod 11 def setUpClass(cls): 12 cls.driver = webdriver.Chrome() 13 14 def setUp(self): 15 self.driver.get("https://www.cnblogs.com/lxs1314/") 16 17 18 def test_a(self): 19 t = self.driver.title 20 print(t) 21 self.assertIn("杀手", t) 22 23 24 def test_b(self): 25 t = self.driver.title 26 print(t) 27 self.assertIn("彩笔", t) 28 29 def test_c(self): 30 t = self.driver.title 31 print(t) 32 self.assertIn("彩笔杀手lalala", t) 33 34 @classmethod 35 def tearDownClass(cls): 36 cls.driver.quit() 37 38 if __name__ == "__main__": 39 unittest.main()

成功了2个,失败了1个
毕业后这5年里的迷茫,会造成10年后的恐慌,20年后的挣扎,甚至一辈子的平庸!。
人生的道路犹如自己的内裤,没有一条不是自己选的!

浙公网安备 33010602011771号