Enable Chrome extension while being controlled by automated test software - google-chrome-extension

I have some Chrome extensions installed and I can use them fine in normal run.
But when I use Selenium to drive Chrome to a page, I see "Chrome is being controlled by automated test software." and I don't have access to those extensions that I have installed. What are some easy ways to have access to the extensions in this kind of scenario? Is there some setting in Chrome perhaps that enables extensions in every mode?

Yes, there are a series of flags you'r need to set up to achieve that.
You can also simply use Selenium-Profiles or undetected-chromedriver for that. Those libraries additionally are undetected by sites like cloudfare and google.

Related

How do I get access to all the files in the extension in Chrome Extension Manifest Version 3 (MV3)?

Background
I've been using the crx-hotreload package to auto-reload my chrome extensions during development because it's annoying to have to click the refresh button on the Extensions page every time you make a change; however, this package doesn't work with MV3 because it uses the chrome.runtime.getPackageDirectoryEntry method, which seems to have been removed from chrome.runtime in MV3. I can't find documentation to confirm that it was removed, but it's not there when I try to use it.
Questions
Does anyone know how to get access to all the files in the extension directory in Chrome Extension Manifest Version 3?
Or generally, is there a better way that I can hot-reload my chrome extensions during development that would work for MV3?
This is one of many things based on DOM capabilities of background pages that are removed from ManifestV3 because service workers don't have DOM. For example, getPackageDirectoryEntry is using the old nonstandard FileSystem API in its returned value.
As to why, apparently the switch to service workers simplifies the internal source code in Chromium, even if it doesn't provide any real improvements for extension authors or users.
At this point all you can do is present a convincing use case and ask Chromium developers via https://crbug.com to implement an alternative API.

How to restrict access to my firefox addon published on addons.mozilla.org

I developed an addon for firefox which I want to distribute among my group. I don't want to make it visible to everyone. How can I put that restriction for my published addon.
I did the same for chrome extension where my listed emails can install my chrome extension only.
Such an option is not available for extensions listed on AMO. It's either available for everyone or not at all.
Unlike CWS, with Firefox you can opt to self-distribute the extension (AMO will only do the signing, hosting and updating is on you), and then how you control access is up to you.
However, once someone has the XPI file, they can share it with anyone. This is technically true of Chrome extensions as well: once installed, they can be ripped and shared.
If you truly need to limit functionality for non-members, the only way is to offload some non-trivial part of the program to a server that requires access credentials.

Chrome extension to change Desktop wallpaper

I'm diving into the world of Chrome Extension development, primarily because there is a very small feature that is missing in Chrome that I miss dearly. The context-menu option to "Set as background/wallpaper" like that found in Firefox. Sounds trivial, but it's convenient.
I have most of the "basic" stuff worked out with the manifest file, am able to install it, even managed to get it to show up as a context menu item.
The problem obviously is that I am wanting to mess with a user's OS-level settings which is extremely difficult because of security issues (fully understand this).
I found an extension that allowed this in older versions of Chrome, and it looked like the developer used some type of .dll and C++ to accomplish this.
I'm not really sure how to make this work.
Since that Chrome doesn't allow these kind of manipulations (such as your PC's settings), you will need to create a native application that will run beside your extension. When the user chooses the image from your extension and selects "use as wallpaper", you will use the native messaging API to send a message to your desktop application, that will set the wallpaper (and do whatever else you can't do within a chrome extension) for you.
You can use the chrome.wallpaper app api to set the wallpaper after using the messaging api to send the image from your extension.

Global(system) hotkeys for chrome extension

Is it possible to create system hotkeys/shortcuts for Google Chrome Extension? I mean hotkeys that also works when Chrome doesn't have focus.
Yes, but it won't be trivial. To get truly global hotkeys you will have to use native messaging. You will need to create some application to run in the background and capture keypresses and then you can send those keypresses back to Chrome through stdout. This approach will require you to create an additional installer for your extension to install the native messaging app onto the user's system...before you could bundle your app along with the extension (using NPAPI) but that has recently been phased out. I have seen some discussion in the Chromium group about adding bundling support for native messaging apps, but nothing has been added (yet).
Another much easier option is to use the Chrome commands API which will enable you to use hotkeys across all Chrome windows (but not globally...). Just something to consider if "true" global hotkeys are not an absolute requirement since this approach is (much) less complex.
Global media keys will be added to Chrome soon, however. There is a good discussion about this feature to read here.
It's now part of Chrome: chrome://extensions/shortcuts

Creating a single set up for chrome, safari, firefox and IE extension?

I have built an extension for all four major browsers like firefox(.xpi), chrome(.crx),
safari(.safariextz) and IE(.exe). I am able to install these extension separately. But I need one setup for all four extension. Can anybody guide me how to create one setup project for all four extensions?
You can use any kind of installer to perform this task.
On Windows I use NSIS it has functions/plugins that allow you to write to registries, manipulate files, detect Browser versions etc. Which are basically the only things you need to install a browser extension

Resources