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方法,采用包含判断

浙公网安备 33010602011771号