在Windows 7中使用python2.7,selenium(最新版本用pip下载)和Firefox 25.0.1。
我尝试运行以下最小的selenium代码示例,但它只是打开一个空白的Firefox页面并抛出WebdriverException:
from selenium import webdriver
driver = webdriver.Firefox()
Traceback (most recent call last):
File "", line 1, in
driver = webdriver.Firefox()
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 60, in init
desired_capabilities=capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 71, in init
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 136, in check_response
raise exception_class(value)
WebDriverException: Message: u'\r\n\r\nGateway Timeout 504\r\n \r\n\r\n'
当我使用Selenium IDE运行测试脚本时,我没有连接问题,只有python代码。 我怎样才能解决这个问题?我无法超越“driver = webdriver.Firefox()”行。