python 脚本运行问题:
---------------------------------------------------
======================================================================
ERROR: test_creat (__main__.Creat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "creat.py", line 11, in setUp
self.driver = webdriver.Firefox()
File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\webdriver.py"
line 59, in __init__
self.binary, timeout),
File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\extension_con
ection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\firefox_binar
.py", line 61, in launch_browser
self._wait_until_connectable()
File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\firefox_binar
.py", line 105, in _wait_until_connectable
self.profile.path, self._get_firefox_output()))
WebDriverException: Message: "Can't load the profile. Profile Dir: c:\\docume~1
\admini~1\\locals~1\\temp\\tmppy7eht Firefox output: *** LOG addons.xpi: startu
\r\n*** LOG addons.xpi: Skipping unavailable install location app-system-local\
\n*** LOG addons.xpi: Skipping unavailable install location app-system-share\r\
*** LOG addons.xpi: checkForChanges\r\n"
----------------------------------------------------------------------
Ran 1 test in 71.609s
FAILED (errors=1)
-----------------------------------------------------
go了半天没有什么头绪,看报错应该是找不到c:\\docume~1\admini~1\\locals~1\\temp\\tmppy7eht 中的firefox, 自己找了一下,也没有发现,嘻嘻,最后重新安装了一下
找到http://selenium.googlecode.com/git/docs/api/py/index.html ,测试了一下
-------------------------------------
Example 0:
open a new Firefox browser
load the page at the given URL
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')
--------------------------------------
ok可以打开了,再次测试之前的脚本ok了。看来就是安装firefox的路径问题,问题是如果不重新安装,如何配置一下可以让selenium自己找到firefox呢?这是个问题:)
[?]如何配置一下可以让selenium自己找到firefox
没有评论:
发表评论