Brackets - Live Preview in chrome even after brackets was uninstalled - google-chrome

I uninstalled Brackets from Ubuntu 16.04 using the commands:
$ sudo apt-get remove brackets
$ sudo add-apt-repository --remove ppa:webupd8team/brackets
But now whenever I try to open google chrome, it opens the following window:
And even the name of the application got changed from Google Chrome to Bootstrap Images - Google Chrome:
I was building a website using Bootstrap which the explains the reason behind the new name.
Now whenever I open a HTML file, it always opens the live preview window on the first tab.
I can open google chrome normally when I type in the terminal:
$ google-chrome-stable
How can I fix this?
P.S. I already tried reinstalling chrome.

To remove the brackets live preview integration you need to update this file
~/.local/share/applications/chrome.desktop
The file will have the following line -
Exec=/opt/google/chrome/chrome --user-data-dir=/home/<user>/.config/Brackets/live-dev-profile/Default/ --no-first-run --no-default-browser-check --disable-default-apps --allow-file-access-from-files --temp-profile file:///opt/Brackets/LiveDevelopment/launch.html
Which is basically the command that is run for starting chrome.
Remove the--user-data-dir and file:///opt/Brackets/LiveDevelopment/launch.html plus any other options that you don't need and then start chrome.
Chrome should open without the Brackets live integration.

Related

VSCode open-in-browser won't open google-chrome (ubuntu)

When I try to run the open-in-browser extension (TechER version; there are a few such extensions by roughly the same name) in VS Code (1.41.1), I continually get the following error message: "Open browser failed!! Please check if you have installed the browser correctly!"
I reinstalled google-chrome, made sure it was default, double-checked the xdg settings, but it still won't work. Any suggestions much appreciated
It is because there is no binary executable named google-chrome may be yours is google-chrome-stable .
One thing you can do is to copy the binary file google-chrome-stable and create a renamed file google-chrome
Or you can set a bah alias
alias google-chrome='google-chrome-stable'
I was having this same issue with the "open in browser" extension. I clicked on the settings icon and installed an older version 1.1.0. Its working again for me.

Run chrome lighthouse's audit from command line

I would like to write a script which run (from the chrome's binary) its lighthouse's audit with a url given.
I didn't manage to find how to do it, but since there is even a chrome extension doing I assume it should be feasible right ?
Google Lighthouse can be ran using the command line. To run it from the command line, you must first install:
Google Chrome for Desktop
Node.js v6 or later.
To install the Lighthouse CLI, open a command line and type the following command:
npm install -g lighthouse
To run an audit with Lighthouse, type:
lighthouse https://example.com
By default, Lighthouse writes the report to an HTML file. You can control the output format by passing flags.
You will notice that a Chrome window is opened every time you run Lighthouse. If you don't want a window to be opened, you can run it in headless mode:
lighthouse https://example.com/ --chrome-flags="--headless"
For the complete list of options, type:
lighthouse --help
Take a look at the Lighthouse source code repository for additional documentation and examples.
You can use/test via npx:
npm i npx -g
Then, directly run from your terminal without using a package.json created or installing globally & without opening a chrome browser instance:
npx lighthouse <URL> --only-categories="performance,seo,Accessibility" --chrome-flags="--headless"

How do I use Headless Chrome in Chrome 60 on Windows 10?

I've been looking at the following article about Headless Chrome:
https://developers.google.com/web/updates/2017/04/headless-chrome
I just upgraded Chrome on Windows 10 to version 60, but when I run either of the following commands from the command line, nothing seems to happen:
chrome --headless --disable-gpu --dump-dom https://www.google.com/
chrome --headless --disable-gpu --print-to-pdf https://www.google.com/
And I'm running all of these commands from the following path (the default installation path for Chrome on Windows):
C:\Program Files (x86)\Google\Chrome\Application\
When I run the commands, something seems to process for a second, but I don't actually see anything. What am I doing wrong?
Thanks.
Edit:
As noted by Mark Rajcok, if you add --enable-logging to the --dump-dom command, it works. Also, the --print-to-pdf command works as well in Chrome 61.0.3163.79, but you'll probably have to specify a different path for the output file in order to have the necessary permissions to save it.
As such, the following two commands worked for me:
"C:\Program Files (x86)\Google\Chrome\Application\chrome" --headless --disable-gpu --enable-logging --dump-dom https://www.google.com/
"C:\Program Files (x86)\Google\Chrome\Application\chrome" --headless --disable-gpu --print-to-pdf=D:\output.pdf https://www.google.com/
I guess the next step is being able to step through the dumped DOM like PhantomJS with DOM selectors and whatnot, but I suppose that's a separate question.
Edit #2:
For what it's worth, I recently came across a Node API for Headless Chrome called Puppeteer (https://github.com/GoogleChrome/puppeteer), which is really easy to use and delivers all the power of Headless Chrome. If you're looking for an easy way to use Headless Chrome, I highly recommend it.
This works for me:
start chrome --enable-logging --headless --disable-gpu --print-to-pdf=c:\misc\output.pdf https://www.google.com/
... but only with "start chrome" and "--enable-logging" and with a path (for the pdf) specified - and if the folder "misc" exists on the c-directory.
Addition: ... the path for the pdf - "c:\misc" above - can of course be replaced with any other folder/dir.
With Chrome 61.0.3163.79, if I add --enable-logging then --dump-dom produces output:
> "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --enable-logging --headless --disable-gpu --dump-dom https://www.chromestatus.com
<body class="loading" data-path="/features">
<app-drawer-layout fullbleed="">
...
</script>
</body>
If you want to programatically control headless Chrome, here's one way to do it with Python3 and Selenium:
In an Admin cmd window, install Selenium for Python:
C:\Users\Mark> pip install -U selenium
Download ChromeDriver v2.32 and extract it. I put the chromedriver.exe in C:\Users\Mark, which is where I put this headless.py Python script:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("headless") # remove this line if you want to see the browser popup
driver = webdriver.Chrome(chrome_options = options)
driver.get('https://www.google.com/')
print(driver.page_source)
driver.quit() # don't miss this, or chromedriver.exe will keep running!
Run it in a normal cmd window:
C:\Users\Mark> python headless.py
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" ...
... lots and lots of stuff here ...
...</body></html>
Current versions (68-70) seem to require --no-sandbox in order to run, without it they do absolutely nothing and hang in the background.
The full commands I use are:
chrome --headless --user-data-dir=tmp --no-sandbox --enable-logging --dump-dom https://www.google.com/ > file.html
chrome --headless --user-data-dir=tmp --no-sandbox --print-to-pdf=whatever.pdf https://www.google.com/
Using --no-sandbox is a pretty bad idea and you should use this only for websites you trust, but sadly it's the only way of making it work at all.
--user-data-dir=... uses the specified directory instead of the default one, which is likely already in use by your regular browser.
However, if you're trying to make a PDF from HTML, then this is fairly useless, since you can't remove header and footer (containing text like file:///...) and the only viable solution is to use Puppeteer.
You should be good. Check under the Chrome Version directory
C:\Program Files (x86)\Google\Chrome\Application\60.0.3112.78
For the command
chrome --headless --disable-gpu --print-to-pdf https://www.google.com/
C:\Program Files (x86)\Google\Chrome\Application\60.0.3112.78\output.pdf
Edit:
Still execute commands where the chrome executable is, in this instance
C:\Program Files (x86)\Google\Chrome\Application\
I know this question is for Windows, but since Google gives this post as the first search result, here's what works on Mac:
Mac OS X
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --dump-dom 'http://www.google.com'
Note you MUST put the http or it won't work.
Further tips
To indent the html (which is highly desirable in real pages that are bloated), use tidy:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --dump-dom 'http://www.google.com' | tidy
You can get tidy with:
brew install tidy
If you want to dodge on the problem in general, and just use a service of some kind to do the work for you, I'm the author/founder of browserless which attempts to tackle running headless Chrome in a service-like fashion. Other than that it's pretty tough to keep up with the changes and making sure all the appropriate packages and resources are installed to get Chrome running, but definitely doable.
I solved it by running this (inside chrome.exe directory),
start-process chrome -ArgumentList "--enable-logging --headless --disable-gpu --print-to-pdf=c:\users\output.pdf https://www.google.com/"
you can choose your own path.print-to-pdf=<<custom path>>

Chromium Browser (Linux Chrome) unable to display WebGL

I am running Chrome (chromium-browser on Linux Mint).
Version 22.0.1229.94 Built on Ubuntu 12.10, running on LinuxMint 14 (161065)
I can't seem to get webGL enabled on it, it has worked previously.
chrome://gpu shows "WebGL has been disabled, either via about:flags or command line."
So I have checked chrome://version/gpu
Which shows: Command Line /usr/lib/chromium-browser/chromium-browser --disable-new-tab-first-run --enable-user-scripts --flag-switches-begin --enable-accelerated-filters --disable-accelerated-2d-canvas --disable-gpu-vsync --disable-threaded-animation --disable-webgl --js-flags=--harmony --enable-nacl --enable-experimental-extension-apis --force-compositing-mode --ignore-gpu-blacklist --flag-switches-end
Which implies its getting disabled in the commandline. chrome://flags doesn't have webgl disabled.
/etc/chromium-browser/default only has CHROMIUM_FLAGS="--disable-new-tab-first-run --enable-user-scripts"
I have also tried running chrome direct via /usr/bin/chromium-browser
I can't see how this is getting disabled in the commandline. Is there something else I should change to enable it ?
Only way I've managed to fix it, was to do a rm -Rf /home/(username)/.config/chromium. Removing the Default directory inside it wasn't enough. WebGL is now enabled as default, without any further changes.

How to test google chrome workspaces on linux?

I saw this two videos
http://www.youtube.com/watch?v=kVSo4buDAEE
http://www.youtube.com/watch?v=x6qe_kVaBpg
and I wanted to try google workspaces on my linux desktop
I followed these instructions: https://plus.google.com/+GoogleChromeDevelopers/posts/644qQuBKZeL
And this detailed tutorial: http://devcoma.blogspot.it/2013/01/how-to-enable-workspace-experiment-on.html
But the "File system folders in Sources Panel" won't show up
I tried with "Chromium Version 25.0.1364.160 Ubuntu 13.04 (25.0.1364.160-0ubuntu3)"
and also with "Chrome Version 29.0.1530.2 dev"
(I installed this dev version from http://www.chromium.org/getting-involved/dev-channel)
Anybody had any luck whith this?
I found the way to test it.
These are the steps I had to follow
Install a ppa with a more recent chromium version, from here:
http://www.webupd8.org/2012/09/new-chromium-stable-and-development.html
sudo add-apt-repository ppa:a-v-shkop/chromium-dev
sudo apt-get update
sudo apt-get install chromium-browser
as of today it install Version 27.0.1453.6 Ubuntu 13.04 (191032)
Open the browser and in the url bar enter chrome://flags/
enabled "Enable Developer Tools experiments."
restart the browser
open the web page you want to debug using workspaces
press F12 to open the dev tool
press F1 to open the settings panel
go to Experiments and check "File system folders in Sources Panel"
restart browser
in your file system, add a file named .allow-devtools-edit
cd
touch .allow-devtools-edit
once again, press F12, F1, and select Workspace, add folder, and add the root of your project
to map your web site to your file system, right click on any js file and select 'Map to network resource', then choose the corresponding file
and that's it, in the Workspace section of your Settings, you will see that a mapping has been added, with something like
'http://localhost:9000' -> '/home/opensas/dev/apps/my_js_project'
The good news is that it seems that with the latest Google Chrome development version everything works out of the box, no need to mess around with development or experimental features.
This question is a duplicate for this one
In the Dev-channel version things were changed a bit.
So you don't need to enable devtools experiments
and don't need to manually create .allow-devtools-edit