• 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()
    View Code

     

    成功了2个,失败了1个  

  • 相关阅读:
    获取本地地址,获取上传文件的后缀
    foreach
    es6入门
    jquery-ui 拖拽排序
    移动端常用
    vue父子组件通信
    Weinre(pc调试手机页面)
    Ztree的使用
    jquery on() 转
    c++ 基本使用
  • 原文地址:https://www.cnblogs.com/lxs1314/p/8405120.html
Copyright © 2020-2023  润新知