Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Chrome Extensions using command prompt

Is it possible to run a chrome extension from command line? I need to automate the process for my software, and my software will need to run that extension with a particular parameter.

I am using a Chrome Extension 'APK Downloader' by Yogi. The Extension works like this:- "If a page contains any .apk file link, then when I click on the extension's icon on the address bar, it starts direct download of that .apk file"

Now, I have my software that needs some .apk file to download [The software will have the package name of the .apk file to be downloaded, which is used by the extension to generate a download link]. It will be an automatic process. So, I need to know if it is possible to pass a parameter to the extension automatically, and make the extension to work without clicking on it.

Is it possible to do so??

like image 618
Vivek Avatar asked Mar 05 '14 09:03

Vivek


2 Answers

Unpacked extension can be loaded using the --load-extension= flag.

What I usually do is chromium --user-data-dir=/tmp/someuniquedirname --load-extension=path/to/extension --no-first-run.

  • The --user-data-dir= flag is used to specify a non-default user data directory, to minimize conflicts between your existing browser profile and the test directory. You can omit this flag if you want to use your default user profile.
  • The --no-first-runflag prevents the first run UI from showing up (e.g. the bubble that explains how to use the omnibox, and a "Getting Started" page that opens in a new tab).

You can load multiple extensions by separating the paths by commas, e.g. chromium --load-extension=path/to/one/extension,path/to/another/extension.

I have published some shell scripts and a convenience extension to speed up (manual) testing of Chrome extensions. Take a look at https://github.com/Rob--W/extension-dev-tools/tree/master/chrome.

like image 167
Rob W Avatar answered Oct 14 '22 22:10

Rob W


it helps to open extension normally and after that hit F12 (dev tools) to see actual url... having that i can, for example load "Selenium IDE" chrome extension as (run from command prompt)

"C:\Program Files (x86)\Google\Chrome\Application\new_chrome.exe" chrome-extension://mooikfkahbdckldjjndioackbalphokd/index.html
like image 36
Sasha Bond Avatar answered Oct 14 '22 21:10

Sasha Bond