Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define WebExtensions in moz:firefoxOptions capabilities #1476

Open
titusfortner opened this issue Jan 19, 2019 · 20 comments
Open

Define WebExtensions in moz:firefoxOptions capabilities #1476

titusfortner opened this issue Jan 19, 2019 · 20 comments

Comments

@titusfortner
Copy link

titusfortner commented Jan 19, 2019

This is a feature request, feel free to close / redirect me if there's a better place to do this.

For reference, the Selenium Ruby code no longer seems to work for using Firefox::Profile#add_extension. I see that there's an endpoint to do this now, but this really seems like something that belongs in the capabilities information, not changed after opening the browser.

Ideally we wouldn't need "complicated" code to create a whole profile, we should be able to just encode the extension and pass it along in the capabilities like this:

{
    "capabilities": {
        "alwaysMatch": {
            "moz:firefoxOptions": {
                "extensions": [base_64_string_extension_one, base_64_string_extension_two]
            }
        }
    }
}

Alternatively, we (I) need to figure out how to fix the Ruby code. :)

@andreastt
Copy link
Contributor

I don’t think I’m opposed to this idea, but it would be a fairly low priority since we already have POST /session/{session id}/addon/install.

@andreastt andreastt changed the title Easier Extension Adding Define WebExtensions in moz:firefoxOptions capabilities Jan 21, 2019
@whimboo
Copy link
Collaborator

whimboo commented Jan 21, 2019

I feel this only adds confusion so I agree with Andreas. AFAIK also all other bindings make use of that specific end-point Andreas pointed out, and we haven't heard complains about it not working.

@titusfortner
Copy link
Author

@whimboo that's incorrect.
As far as I know, Chrome is the only other browser that supports adding extensions, and it is definitely done in the capabilities as a path to the extension: http://chromedriver.chromium.org/extensions

As a tester I feel very strongly that everything related to the browser setup should be able to go into a config file and loaded when initializing the session. The solution you provide will force me to add conditionals to my test logic and likely hard code the values I need somewhere independent of the rest of my configuration code.

For example, I'm putting everything I need in a yaml, then pull values from it, then merge it in. This means favoring lookups over conditionals, reducing the complexity of the initialization code.

@whimboo
Copy link
Collaborator

whimboo commented Jan 21, 2019

I see. That would indeed be helpful then. Sorry, if I misunderstood it before.

In that case we can offer that extension property, and let geckodriver install the listed extensions right after creating the session by using the internal Addon:Install command.

@jps042
Copy link

jps042 commented Jun 25, 2019

Was this issue ever resolved? I am able to specify adding an extension in chrome through chromeOptions like

Selenium::WebDriver::Remote::Capabilities.chrome({
                                                                               'chromeOptions' => {
                                                                                   'extensions' => [
                                                                                       Base64.strict_encode64(File.open(crx_path,'rb').read)
                                                                                   ],
                                                                                   prefs: prefs,
                                                                                   args: switches,
                                                                                   detach: true
                                                                               }
                                                                           })

and I would like to be able to do the same for firefoxOptions like:

Selenium::WebDriver::Remote::Capabilities.firefox({
                                                                                   "capabilities": {
                                                                                       "alwaysMatch": {
                                                                                           "moz:firefoxOptions": {
                                                                                               'extension' => [
                                                                                                   Base64.strict_encode64(File.open(xpi_path,'rb').read)
                                                                                               ],
                                                                                               args: switches,
                                                                                               prefs: prefs,
                                                                                               log: {
                                                                                                   "level": "trace"
                                                                                               }
                                                                                           }
                                                                                       }
                                                                                   }
                                                                               })

Any update would be much appreciated :)

@whimboo
Copy link
Collaborator

whimboo commented Jun 27, 2019

No, it's not fixed but I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1561841 to track this request internally.

@pandasm
Copy link

pandasm commented Oct 1, 2020

This one is open from an year, can we get any progress or any workaround ?

@whimboo
Copy link
Collaborator

whimboo commented Oct 2, 2020

We are currently not working on that due to other priorities. As workaround you can still use the vendor endpoint /session/{sessionId}/moz/addon/install to install an add-on.

@bonigarcia
Copy link

+1 to this feature. See this issue for some test examples that would benefit with the installation of web extensions with firefox options.

@titusfortner
Copy link
Author

Wrong link in @bonigarcia's comment: SeleniumHQ/selenium#10946

@whimboo
Copy link
Collaborator

whimboo commented Jun 19, 2023

@titusfortner and @christian-bromann is https://bugzilla.mozilla.org/show_bug.cgi?id=1561841#c4 what you would like to see? Any other feedback from your side? Thanks.

@whimboo
Copy link
Collaborator

whimboo commented Jun 26, 2023

@nechaev-chromium given that Maxim isn't around right now maybe you could have a look at https://bugzilla.mozilla.org/show_bug.cgi?id=1561841#c4 and let me know if that is something you might consider as well for chromedriver in case Chrome requires such additional permissions? Thanks.

@christian-bromann
Copy link

@christian-bromann is https://bugzilla.mozilla.org/show_bug.cgi?id=1561841#c4 what you would like to see? Any other feedback from your side? Thanks.

What you have proposed sounds good to me. I think there is value having the ability to install a web extension on session start as well as during runtime as long as we find a common specification and browser handling for it.

@titusfortner
Copy link
Author

Previous code bases I've used, the configuration files and the browser specific conditionals were all applied and managed before the driver started. Obviously it can be worked around, but I've heard more complaints that Firefox can't install extensions in the capabilities than that chrome can't uninstall extensions.

@whimboo
Copy link
Collaborator

whimboo commented Aug 7, 2023

Thank you all for the feedback. Looks like we should find a common way to install webextensions via capabilities.

@nechaev-chromium given that Maxim isn't around right now maybe you could have a look at https://bugzilla.mozilla.org/show_bug.cgi?id=1561841#c4 and let me know if that is something you might consider as well for chromedriver in case Chrome requires such additional permissions? Thanks.

@mathiasbynens maybe you could have a look? Not sure whom else to ask around chromedriver's implementation while Maksim is out. Thanks.

@whimboo
Copy link
Collaborator

whimboo commented Jan 4, 2024

@sadym-chromium mind having a look at my last comment? Thanks!

@sadym-chromium
Copy link

@whimboo next week, after my vacation. Or feel free to ping other our folks

@whimboo
Copy link
Collaborator

whimboo commented Feb 1, 2024

@whimboo next week, after my vacation. Or feel free to ping other our folks

@sadym-chromium ping - in case it slipped through. :)

@sadym-chromium
Copy link

I'm not sure if it's possible to implement "extensionsInstallTemporarily": false in Chrome. WRT extensionsAllowPrivateBrowsing, is it still required, if we have UserContexts?

@whimboo
Copy link
Collaborator

whimboo commented Feb 2, 2024

Maybe lets follow-up on w3c/webdriver-bidi#548 for further discussion given that this is basically a spec and not a driver issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants