selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🚀 Feature]: Support installation and uninstallation of web extensions via WebDriver BiDi

Open whimboo opened this issue 8 months ago • 13 comments

Description

WebDriver BiDi now has commands for installing and uninstalling web extensions which Chrome and Firefox have already implemented. As such it would be good to get those APIs as well added to Selenium.

https://w3c.github.io/webdriver-bidi/#command-webExtension-install https://w3c.github.io/webdriver-bidi/#command-webExtension-uninstall

CC @pujagani.

Have you considered any alternatives or workarounds?

No response

whimboo avatar Apr 07 '25 09:04 whimboo

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

Selenium Triage Team: remember to follow the Triage Guide

selenium-ci avatar Apr 07 '25 09:04 selenium-ci

Please note that in Firefox 137 we install the extension permanently which means that it's not allowed to install an unsigned or unpacked extension. This will be fixed in version 138.

whimboo avatar Apr 07 '25 09:04 whimboo

"One line code" solution for .NET/C#. The primary question would be hoe to test whether an extension is installed successfully. I guess if the command executed without errors, we can treat it as success.

nvborisenko avatar Apr 11 '25 20:04 nvborisenko

Yes, that is correct.

whimboo avatar Apr 11 '25 21:04 whimboo

We can also assert the id of the extension with the extension id provided.

Delta456 avatar Apr 11 '25 21:04 Delta456

@whimboo I have implemented installation and uninstallation of web extensions in Java binding. I need to wait for stable 138 Firefox version before I can PR.

Delta456 avatar Apr 15 '25 15:04 Delta456

@Delta456 if you don't have a signed XPI to test that I would recommend, yes. Before that unsigned XPIs and unpacked web extensions will not work.

whimboo avatar Apr 15 '25 18:04 whimboo

Yes, I am waiting for the version. Please ping me here when its out 😃

Delta456 avatar Apr 15 '25 18:04 Delta456

@Delta456 Excited to see your PR! We're removing the --load-extension flag in some situations in Chrome, and as a result there is community interest in seeing an alternative fairly soon.

Of course, since we're making the change we're open to spending some time on the necessary changes across libraries.

Do you plan to continue work on your PR? Is there anything I can do to help?

Of course, we should make sure the Selenium team are also supportive of this. I'm not sure if I've seen anything confirming that yet.

oliverdunk avatar May 12 '25 18:05 oliverdunk

Hi @oliverdunk, the implementation is done. I am awaiting someone to review my PR and hoping the browser versions are now updated. Neither Chrome stable or nightly does not support Web Extension BIDI, as shown on WPT

Image

Delta456 avatar May 12 '25 19:05 Delta456

Neither Chrome stable or nightly does not support Web Extension BIDI, as shown on WPT

We do support it, but only from a path. I believe this is what the middle line is showing in the WPT results.

I am awaiting someone to review my PR

Oh, great. Have you considered unmarking it as a draft? I expect that might encourage the maintainers to take a look.

oliverdunk avatar May 12 '25 19:05 oliverdunk

We do support it, but only from a path. I believe this is what the middle line is showing in the WPT results.

Yes, Firefox is working completely, so I have made a PR based on that. We can add Chrome support as per the version releases.

Oh, great. Have you considered unmarking it as a draft? I expect that might encourage the maintainers to take a look.

The CI has been failing because the version bump didn't happen, so I kept it a draft.

Delta456 avatar May 12 '25 19:05 Delta456

The support for webExtensions in python bindings have landed via https://github.com/SeleniumHQ/selenium/pull/15749 and is available in release 4.33.

Firefox and chromium based browsers can utilize this bidi module, but chrome/edge requires 2 additional flags in order to work:

  1. --remote-debugging-pipe
  2. --enable-unsafe-extension-debugging

#15794 aims to add a chrome/edge option - enable_webextensions that simplifies this. Until this is merged, the above flags need to be passed for extensions to work.

navin772 avatar May 26 '25 17:05 navin772

Hi @oliverdunk, https://github.com/SeleniumHQ/selenium/pull/15660 has been merged.

Delta456 avatar Jun 24 '25 10:06 Delta456

Hi @oliverdunk, #15660 has been merged.

Thanks @Delta456, that's great! I really appreciate your time on this. I will let developers who have asked about it in the past know.

oliverdunk avatar Jun 24 '25 10:06 oliverdunk