0

I need to launch Firefox with Browsec add-on. I've written some code, but get an error:

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)

What i get is:

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>)

How can i fix that error?

tnsaturday
  • 527
  • 2
  • 10
  • 31
  • the error message is clear, but better approach is using existing browser profile. See https://stackoverflow.com/questions/50562675/selenium-chromedriver-open-chrome-normally/50568965#50568965. – pburgr Jun 04 '18 at 09:25
  • It's not of use for me. It's Windows and it's Java. While I, as you can see in my question, do Python on Linux. – tnsaturday Jun 08 '18 at 08:05
  • see https://stackoverflow.com/questions/34075752/how-to-set-firefox-profile-on-selenium-driver-linux-python – pburgr Jun 08 '18 at 08:43

0 Answers0