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 則不報錯

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章