Using VSCode WSL Remote, why won't Chrome Debugger launch Chrome for Windows? - google-chrome

I'm switching to VSCode WSL Remote mode for a JavaScript project. The Chrome Debugger Extension always look for Google Chrome in Linux. Is this the correct behavior?
I have a Chrome for Linux installed in WSL, which could run on X server. The problem is that the breakpoints are not working.
I've tried removing Chrome in WSL, the extension will then throw Can't find Chrome - install it or set the "runtimeExecutable" field in the launch config.
Should I set "runtimeExecutable" to chrome.exe or force it to run on local side with
"remote.extensionKind": {
"msjsdiag.debugger-for-chrome": "ui",
}
Could I correct some config so that the Chrome Debugger can find the Chrome in Windows if there's no Linux install?
Is there any official guide for it?
Thanks!

Yes, you should set
"remote.extensionKind": {
"msjsdiag.debugger-for-chrome": "ui"}
An alternative would be to set an alias chrome to go to chrome.exe in Windows. To ensure persistence, add it to your ~.bashrc or shell equivalent or alternatively .profile.
Side note: you should be able to debug with the new chromium-based Edge as well if you prefer using that.

Related

Does headless Chrome auto update?

Does Chrome update itself when running in headless mode by selenium?
It seems, it is not updating, probably because of --disable-background-networking switch set by Selenium by default. I want to ensure that's indeed the case. If there any reference in documentation explaining either auto-update behavior or meaning of switches and their impact? So far best I've found is list with all command line Chrome switches with some comments, but it is still not clear.
No, Chrome Browser Client doesn't update itself when running in headless mode by selenium.
As per Getting Started with Headless Chrome the Headless Chrome is the server environment where you don't need a visible UI shell.
If you've got Chrome 59+ installed, you start Chrome with the --headless flag as follows:
chrome \
--headless \ # Runs Chrome in headless mode.
--disable-gpu \ # Temporarily needed if running on Windows.
chrome should always point to your installation of Chrome. Of course, the exact location varies from platform to platform.
So until and unless the original Chrome Browser is automatically/manually updated, Chrome Browser Client doesn't get updated.
TL;DR
--disable-background-networking is configured to disable several subsystems which run network requests in the background. This is used when performing network performance testing in order to avoid noise in the measurements.

Get URL of currently active chromium or chrome tab from external process

How can I get the current chromium tab URL from an external process in linux programmatically?
There are many similar questions to this one, but I haven't found any with the following requirements
Solution should work from outside of the chrome process, i.e. not within javascript or a chrome extension.
Solution should not be based on autohotkey, xdotool, wmctrl or similar tools for simulating keyboard or mouse input
No OSX or Windows-specific solutions
In firefox, there is mozrepl, which exposes browser internals through an interactive repl over a TCP port. I am looking for something similar in chromium or chrome, even if it means installing a chrome extension.
I implemented #Asesh suggestion in https://github.com/erjoalgo/chrome-current-url, it is a chrome extension that exposes the currently active tab's URL through a local http server.
pip install chromeurl
sudo chromeurl --install-manifest native
Then install the extension from the webstore
Finally, query the current chrome url:
$ curl http://localhost:19615/tabs/current/url
https://developer.chrome.com/extensions/activeTab

Chrome Headless Doesn't work

I've read about the Chrome Headless from developers.google said we can run the Google without UI. Quote from that link :
Headless Chrome is shipping in Chrome 59. It's a way to run the Chrome
browser in a headless environment. Essentially, running Chrome without
chrome! It brings all modern web platform features provided by
Chromium and the Blink rendering engine to the command line.
Why is that useful?
A headless browser is a great tool for automated testing and server
environments where you don't need a visible UI shell. For example, you
may want to run some tests against a real web page, create a PDF of
it, or just inspect how the browser renders an URL.
This is really great feature, so I do some experiment with this cool feature. The idea is to taking snapshot as the document site by do call of chrome.exe from Windows Command Prompt, as follow :
chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/
After do several times and following the instruction from these site. I got nothing. I don't get any picture or screenshot with name screenshot.png as document mention it before Running with --screenshot will produce a file named screenshot.png in the current working directory.
From this document also said about version,
Caution: Headless mode is available on Mac and Linux in Chrome 59.
Windows support is coming in Chrome 60. To check what version of
Chrome you have, open chrome://version.
after do some check with suggested before, I run chrome://version on my Chrome on Windows x64 Machine and got some result :
Google Chrome 62.0.3202.94 (Official Build) (64-bit) (cohort: Stable)
Revision 4fd852a98d66564c88736c017b0a0b0478e885ad-refs/branch-heads/3202#{#789}
What wrong? What i missed?
Thanks
After do some experiments. for --screenshot will save the image on the same level as chrome.exe location and that will be mean save on Program Files.
So we need need to combine parameter names and arguments with a =
--screenshot="D:\screen.png" will work, otherwise Chrome writes to it's installation folder. Big design flaw, no software should use it's installation folder as a working directory.
Here are the complete argument :
chrome --headless --enable-logging --disable-gpu --screenshot="D:\screen.png" "https://www.chromestatus.com/"

How to add the chrome binary to run e.g. Karma tests on headless chrome on a CI server

I like to run my karma unit tests on a headless chrome. Using karma-chrome-launcher and setting the browser to "ChromeHeadless" works on my machine. But on the CI server it fails with the message "No binary for ChromeHeadless browser on your platform."
Installing chrome on the CI machine is not possible. Is there another way to load the chrome binaries?
for example the google puppeteer module seems to load that when run. from the docs: "Puppeteer downloads and uses a specific version of Chromium". How can i achieve the same?
You can use Puppeteer (headless Chromium), follow these instructions.
If what you fear is that download from the internet might be slow, you can tell puppeteer where to download chrome from and use a local address.
Use PUPPETEER_DOWNLOAD_HOST to specify where to download Chrome from and PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to skip downloading Chrome altogether.
You can read more about this in the documentation.

--disable-web-security not working anymore in Chrome 30

I updated Google Chrome to Version 30.0.1599.69 m. Now the "--disable-web-security" flag is not working. How do I to disable the websecuritiy in Google chrome Version 30.0.1599.69 m
I think the problem is with the chrome instance running in the task bar.
Please check whether any other instance of the Chrome is running in
the task bar. Even a single instance will not let chrome reflect the
command.
Kill all and then try running this command again.
extend disable web security command with --user-data-dir. This worked for me, more details are on >https://bugs.chromium.org/p/chromium/issues/detail?id=575690
Command I use in windows :
"C:\Users\Public\Desktop\Google Chrome.lnk" --disable-web-security --user-data-dir