selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: Unable to Load a .xpi extension on firefox without a FirefoxProfile created

Open gbrabelo opened this issue 3 years ago • 5 comments

What happened?

Hello!

I'm currently migrating from sel3 to sel4 and updating everything that was deprecated. Everything went smoothly, until I migrated everything from FirefoxProfile to FirefoxOptions: Every option still works fine from what I could see, but when I try loading an .xpi extension, I get the following error:

selenium.common.exceptions.WebDriverException: Message: Could not install add-on: C:\Users\gbrabelo\AppData\Local\Temp\addon-01f66145-c781-4da4-ab28-cd20949a695d.xpi: Add-on [email protected] is not compatible with application version. add-on minVersion: 50.0a1.
Stacktrace:
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:186:5
UnknownError@chrome://remote/content/shared/webdriver/Errors.jsm:513:5
install@chrome://remote/content/marionette/addon.js:86:13

Looks to me that the remote driver thinks it is a Chrome? Looks to me that it is unable to compare to Firefox version (>50), even though I'm using the latest Firefox.

Extension used download from: https://docs.lacunasoftware.com/pt-br/articles/web-pki/installation-webpki-gpo.html direct link> https://cdn.lacunasoftware.com/webpki/webpki-ext.zip

How can we reproduce the issue?

from selenium import webdriver
from selenium.webdriver.firefox.service import Service

a_service = Service(executable_path='gecko_path')
driver = webdriver.Firefox(service=a_service)
# it works if you add a profile though>
# driver = webdriver.Firefox(service=a_service, firefox_profile=webdriver.FirefoxProfile())
driver.install_addon('webpki-firefox-ext.xpi', temporary=True)

Relevant log output

selenium.common.exceptions.WebDriverException: Message: Could not install add-on: C:\Users\gbrabelo\AppData\Local\Temp\addon-83b613a7-aed6-4e3c-bf4b-15ebf282470c.xpi: Add-on [email protected] is not compatible with application version. add-on minVersion: 50.0a1.
Stacktrace:
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:186:5
UnknownError@chrome://remote/content/shared/webdriver/Errors.jsm:513:5
install@chrome://remote/content/marionette/addon.js:86:13

Operating System

Win10 and latest Mac

Selenium version

Python 3.10 with Sel4.3.0

What are the browser(s) and version(s) where you see this issue?

Firefox 102

What are the browser driver(s) and version(s) where you see this issue?

gecko v0.31

Are you using Selenium Grid?

No

gbrabelo avatar Jul 27 '22 20:07 gbrabelo

@gbrabelo, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Jul 27 '22 20:07 github-actions[bot]

is there anything I can do to help?

gbrabelo avatar Aug 16 '22 14:08 gbrabelo

I am working on this issue.

TamsilAmani avatar Sep 06 '22 07:09 TamsilAmani

I have tried to install the following 3 .xpi files with the code provided above. In my opinion the issuer's .xpi file has a requirement for FirefoxProfile to be present. @gbrabelo have you tried installing any other addon?

  • Repo XPI = https://github.com/SeleniumHQ/selenium/blob/trunk/common/extensions/webextensions-selenium-example.xpi
  • My XPI (a third-party XPI which I used for testing) = https://addons.mozilla.org/en-US/firefox/addon/ghostery/?src=homepage-collection-featured
  • Issuer XPI = https://cdn.lacunasoftware.com/webpki/webpki-ext.zip (provided above)
  Nothing Set FirefoxProfile Set FirefoxOptions Set
Repo XPI Installs Installs (with warning) Installs
My XPI Installs Installs (with warning) Installs
Issuer XPI Does not Install Installs (with warning) Does not Install

TamsilAmani avatar Sep 06 '22 09:09 TamsilAmani

Also, manually installing the Issuer's XPI on firefox (without being under the control of selenium) gives error. "Web PKI could not be installed because it has a high risk of causing stability or security problems"

So I can conclude that the problem is with the XPI file being used @gbrabelo Screenshot 2022-09-06 at 3 37 31 PM

TamsilAmani avatar Sep 06 '22 10:09 TamsilAmani

For WebPKI latest web-extension version on Firefox, please install through the official setup-site: https://get.webpkiplugin.com/

If access to the latest XPI file is needed, please download it from the all-versions list on the API: [GET] https://get.webpkiplugin.com/firefox-extensions

image

brunocapu avatar Jan 03 '23 13:01 brunocapu

Regardless of how this gets installed. The code in the Selenium repo is sending the correct things to the driver. If the driver or the browser do not like the add-on, then it needs to be addressed with Mozilla.

titusfortner avatar Jan 04 '23 15:01 titusfortner

Hi, @gbrabelo. This issue has been determined to require fixes in GeckoDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an Issue with the GeckoDriver team.

Feel free to comment the issues that you raise back in this issue. Thank you.

github-actions[bot] avatar Jan 04 '23 16:01 github-actions[bot]