selenium-python编写unittest运行代码时候不执行

在使用selenium-python结合unittest进行自动化测试时,遇到运行无结果且无报错的情况,仅显示 Ran 0 tests in 0.00s。通过在测试函数名前添加'test_'前缀,成功使测试运行。具体原理尚待进一步了解。
摘要由CSDN通过智能技术生成
使用python+ selenium 编写简单的自动化脚本的时候,自己写出简单的代码如下:
import unittest
from selenium import webdriver
import time
class LoginCase(unittest.TestCase):
    def setUp(self):
        print('before test')
        self.dr = webdriver.Chrome()
        self.dr.get('http://localhost:81/wp-login.php')
    def write(self):
        user_name = 'admin'
        pass_word = '123456'
        self.t_login(user_name, pass_word)
        title = 'this is title %s' % (time.time())
        self.dr.get('http://localhost:81/wp-admin/post-new.php')
        self.by_name('post_title').send_keys(title)
        self.set_content('content,content')
        self.by_name('publish').click()
        self.dr.get('http://localhost:81/wp-admin/edit.php')
        self.assertEqual(self.by_css('.row-title').text, title)
    def set_content(self, text):
        js = "document.get
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值