错误描述:在python代码中通过selenium来初始化一个firefox浏览器失败,看了下selenium的版本是2.35,然后用firefox --version看了下是28.0,firefox好像不听话自动升级了导致了旧版selenium不支持。
Traceback (most recent call last):
File "C:\Python27\erSiteCompare.py", line 528, in
sys.exit(main())
File "C:\Python27\erSiteCompare.py", line 525, in main
sites.run()
File "C:\Python27\erSiteCompare.py", line 462, in run
self.capture()
File "C:\Python27\erSiteCompare.py", line 353, in capture
self.startSite1()
File "C:\Python27\erSiteCompare.py", line 233, in startSite1
raise e
selenium.common.exceptions.WebDriverException: Message: "Can‘t load the profile.
Profile Dir: c:\\users\\rachelc\\appdata\\local\\temp\\tmp7pjtay Firefox output
:
*** LOG addons.xpi: startup\r\n
*** LOG addons.xpi: Skipping unavailable install location app-system-local\r\n
*** LOG addons.xpi: Skipping unavailable install location app-system-share\r\n
*** LOG addons.xpi: checkForChanges\r\n"
解决办法:
输入sudo pip install -U selenium来升级当前selenium版本,它自动给我连到了pypi.python.com上并获取了一个2.42版本的包,更新之后就能正常使用了。
如果sudo pip提示找不到的话,可以先which pip一下,然后直接sudo那个pip所在目录,可能该bin路径没有包含到bashrc中。
Selenium错误:selenium.common.exceptions.WebDriverException: Message: "Can't load the profile.