标签:rom 新浪 技术分享 print 开始 encoding self info 结果
利用参数化连续打开网页:
#encoding=utf-8
import unittest
import paramunittest
import time
from selenium import webdriver
@paramunittest.parametrized(
{"url":"http://www.baidu.com","result": "百度"},
{"url":"http://www.sina.com","result": "新浪"},
{"url":"http://www.taobao.com","result": "淘宝"},
)
class TestDemo(unittest.TestCase):
def setParameters(self, url, result):
self.url = url
self.result = result
def test_login(self):
self.driver=webdriver.Firefox()
self.driver.get(self.url)
print("开始执行用例:--------------")
time.sleep(0.5)
print("期望结果:%s " % self.result)
if __name__ == "__main__":
unittest.main(verbosity=2)
为了看结果特意没关浏览器:
标签:rom 新浪 技术分享 print 开始 encoding self info 结果
原文地址:https://www.cnblogs.com/garvicker/p/9449398.html