Python+Selenium练习篇之-断言页面标题

from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get('https://www.baidu.com')
time.sleep(3)
try:
assert "百度一下" in driver.title
print ("通过")
except Exception as e:
print ("失败", format(e))

利用python中Assert方法,采用包含判断
posted @ 2018-10-09 20:57  比利乘二  阅读(219)  评论(0)    收藏  举报