我需要使用Browsec插件启动Firefox。我写了一些代码,但收到错误:
from selenium import webdriver
url = input("Enter url to scrape from: ")
profile = webdriver.FirefoxProfile()
profile.add_extension('/home/myusername/.mozilla/firefox/b5qyukpg.default/extensions/browsec@browsec.com.xpi')
browser = webdriver.Firefox()
browser.get(url)
我得到的是:
Traceback (most recent call last):
File "scraper.py", line 7, in <module>
profile.add_extension('/home/myusername/.mozilla/firefox/b5qyukpg.default/extensions/browsec@browsec.com.xpi')
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 95, in add_extension
self._install_extension(extension)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 274, in _install_extension
addon_details = self._addon_details(addon)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 351, in _addon_details
raise AddonFormatError(str(e), sys.exc_info()[2])
selenium.webdriver.firefox.firefox_profile.AddonFormatError: ("[Errno 2] No such file or directory: '/tmp/tmpd7nyxubj.browsec@browsec.com.xpi/install.rdf'", <traceback object at 0x7f23f786eb08>)
我该如何解决这个错误?