使用硒驱动程序测试Django时出错

时间:2019-01-17 16:26:24

标签: selenium-webdriver tdd

硒无法正常运行。如何让我工作? 它显示了我这个错误

Traceback (most recent call last):
   File "functional_tests.py", line 2, in <module>
browser = webdriver.Firefox()
   File "/home/sagar/anaconda3/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
   File "/home/sagar/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
   File "/home/sagar/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
   File "/home/sagar/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
  File "/home/sagar/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException:消息:newSession

这是我的测试。py

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://localhost:8000')
assert 'To-Do' in browser.title
browser.quit()

这是预期的结果

Traceback (most recent call last):
File "functional_tests.py", line 10, in <module> assert 'To-Do' in browser.title
AssertionError

0 个答案:

没有答案