Selenium錯誤:selenium.common.exceptions.WebDriverException: Message: "Can't load the profile.

來源:互聯網
上載者:User

標籤:c   a   tar   com   使用   art   

錯誤描述:在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中。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.