无法使用python selenium在firefox中加载webextension

时间:2018-05-14 13:04:35

标签: selenium web driver

您好我在尝试使用Python Selenium加载Firefox webextension时遇到此问题:

  

selenium.webdriver.firefox.firefox_profile.AddonFormatError :(" [Errno 2]没有这样的    文件或目录:' c:\\ users \\ admini~1 \\ appdata \\ local \\ temp \\ tmpr   wj4ed.xxx.xpi \\ install.rdf'",)

代码如下

from selenium import webdriver

extn_path = "C:\Program Files (x86)\xxxxx\xxx.xpi"
profile = webdriver.FirefoxProfile()
profile.add_extension(extn_path)
self.browser=webdriver.Firefox(profile,executable_path='xxx\geckodriver.exe')

使用的版本

  • Selenium 3.12
  • Gecko v.0.20
  • Firefox- 60

任何人都可以告诉我为什么我要面对这个问题。我确实看到很多人都面临着这个问题,并且提到这是一个已知问题但是最新的Selenium和Gecko驱动程序问题预计会得到解决。

但是,我认为它不起作用。任何提示或输入。

1 个答案:

答案 0 :(得分:0)

你可以尝试使用双前斜线而不是路径中的一条前斜线