Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programatically control a Chrome instance from the command line?

How do I control a running Google Chrome instance from the command line? I'm hoping there's something like a -remote flag that will allow me to send in some javascript or somesuch. In particular, I would like to reload the topmost document on the foremost window.

I'm especially interested in Linux/MacOS solutions.

like image 690
Mark Harrison Avatar asked Jan 19 '10 05:01

Mark Harrison


People also ask

How do I use Chrome from the command line?

Open Chrome Using Command Prompt You can also do the same thing from the “Run” window. Open Run by typing “Run” in the Windows 10 search bar and selecting the “Run” application. Here, type Chrome and then select the “OK” button. The web browser will now open.

How do I access Chrome from terminal?

2. Type "chrome" without quotation marks to run Chrome from the terminal. Chrome is installed in your binary path, so no special directory is required.

How do I run Chrome from the command line in Windows?

Run "%UserProfile%\\AppData\\Local\\Google\\Chrome\\Application\\chrome --version".

What is the command prompt for Chrome?

To open Crosh, you need to press Ctrl + Alt + T, which will launch the terminal window in a new browser tab. You don't need to have your Chromebook's Developer Mode enabled to access Crosh.


2 Answers

Take a look at http://code.google.com/p/chromedevtools/ . It might be you can use the Debugging Protocol to do the job. There is also an Ruby Client. There is also chromix.

like image 190
DrDol Avatar answered Nov 15 '22 11:11

DrDol


You can use this command line tool if you're on a Mac - it uses the Chrome Scripting API, I guess

https://github.com/prasmussen/chrome-cli

like image 30
Brad Parks Avatar answered Nov 15 '22 10:11

Brad Parks