SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.21k stars 8.11k forks source link

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

Closed gbrabelo closed 1 year ago

gbrabelo commented 2 years ago

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 webpki@lacunasoftware.com 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 webpki@lacunasoftware.com 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

github-actions[bot] commented 2 years ago

@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!

gbrabelo commented 2 years ago

is there anything I can do to help?

TamsilAmani commented 2 years ago

I am working on this issue.

TamsilAmani commented 2 years ago

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?

  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 commented 2 years ago

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
brunocapu commented 1 year ago

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

titusfortner commented 1 year ago

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.

github-actions[bot] commented 1 year ago

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.