selenium 测试

chrome 驱动下载地址
https://sites.google.com/a/chromium.org/chromedriver/home

放入代码目录下

运行django

from selenium import webdriver

browser = webdriver.Chrome()
browser.get('http://localhost:8000')
assert 'A' in browser.title

会打开chrome 然后会报错

Traceback (most recent call last):
  File "C:/Users/DL/Documents/superlists/test/functional_tests.py", line 5, in <module>
    assert 'A' in browser.title
AssertionError

如果 A 改为 Django 则不报错

发布了250 篇原创文章 · 获赞 17 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/qq_35899407/article/details/103662397