selenium + chromedriver hangs at start, because chrome is connectting google server first - google-chrome

I use selenium to drive chrome to get some url, but it hangs for about 15 more seconds.
I found that chrome will try to connect www.googleapis.com, clients2.google.com or www.google.com:443. in my environment, google server is not accessible, so it hangs until the connects to google server all failed. this is disgusting. how can i fix it?
UPDATE:
I finally found a perfect solution, you can write a chrome extension and override newtab with:
"chrome_url_overrides":
{
"newtab": "newtab.html"
}
then set chrome start up page to newtab.
Becasue chrome will automatically disable extentions that is not uploaded to chrome extension store. You'd better use chromium instead.

Why not put www.googleapis.com in /etc/hoses (C:\Windows\System32\Drivers\etc\hosts on windows) and point to 127.0.0.1 so that it fails immediately?
I think this will fix the problem.

I try everything to disable chrome from connecting its servers but failed.
But I found a small trick to solve this problem:go to setting page and you can set a url when chrome starts. I set it to http://127.0.0.1:62333. Just a invalid url that failed immediately. this cannot disable chrome from connection its servers but the selenium does not hang anymore.

Related

Problem with content encoding and connecting with DevTools to chrome headless

I am starting a headless chrome instance like that, e.g.
/opt/google/chrome/chrome --headless --disable-gpu --remote-debugging-port=9222 https://www.chromestatus
and want to connect with DevTools to this instance by entering localhost:9222 into a running browser. However, what I see is just some garbled stuff like this here "��TQo�0~ϯ���$���li51����manri̜8�������m::�...", probably because the server process at localhost:9222 sends the response gzipped, but does not include a content-encoding in the response headers (at least, that's my theory why this happens...)
Any idea how I can fix this? I haven't found any option to control this behavior (e.g. to tell the headless chrome instance to not zip the response data...)
BTW: I see the same whether I enter the url in chrome, chromium or firefox or use wget, and also whether I use chrome (Google Chrome 84.0.4147.105) or chromium doesn't make a difference...

IntelliJ IDEA and Google Chrome fail to connect for JavaScript debugging

JetBrains IntelliJ IDEA sometimes loses its own JetBrains IDE Support plugin in Chrome. Upon debugging in IDEA, Chrome complains that:
hmhgeddbohgjknpmjagkdomcpobmllji is blocked
Requests to the server have been blocked by an extension
and stays on this page:
chrome-extension://hmhgeddbohgjknpmjagkdomcpobmllji/loading.html?__QUERY__
Where hmhgeddbohgjknpmjagkdomcpobmllji is JetBrains' plugin ID.
Instead of redirecting to the target page of the form:
http://localhost:63342/__PROJECT__/__PATH__/index.html
Restarting Google Chrome or disabling-and-enabling IDE Support plugin helps. IDEA "finds" Chrome again and Debug workflow works as intended.
Another possible problem is a failed authorization.
To debug a URL like this:
http://localhost:63342/__PROJECT__/__PATH__/index.html
Open it in the browser before starting to debug. It'll give 404 Not Found. Then switch back to IDEA and it will offer you to Copy authorization URL to clipboard:
http://localhost:63342/__PROJECT__/__PATH__/index.html?_ijt=__KEY__
Open this URL.
After this manual authentication is complete, IntelliJ IDEA should be able to debug index.html in Chrome.
IDEA always opens index.html for debugging in the browser window where the latest authentication happened. E.g., in a Chrome Incognito window, instead of a Chrome "normal" window, if you've just authorized IDEA in Incognito.
Going incognito may require an additional setup:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206201319-launching-chrome-incognito-in-intellij-12

Chrome's Dev console doesn't post console.log("message")when page is loaded from localhost (XAMPP Apache Server)

I am running a simple jQuery code (developing a simple webpage), while following a YouTube jQuery & Ajax tutorial. Half way of the tutorial, I was running the index.html file directly from my PC folder on Google Chrome, and console.log("message") worked fine, posting the "message" on Chrome Dev console.
Getting into Ajax territory, the tut suggests running a local Apache Server with XAMPP.
Here is the problem, as the same code doesn't post anything on Chrome Dev console when the index.html is running from localhost throught XAMPP.
PrtSCR of the page loaded from localhost (left) and from file (right)
After a lot of searching I finally found what the problem was!
It was a browser cache issue! (I use Chrome)
So I disabled Chrome Dev cache, and it works fine!
Anonther solution that I found is Cache Killer extension for Chrome, that clears the browsers cache in every page refresh.

Localhost not working in Chrome, 127.0.0.1 does work

I'm trying to run a local node server, but for whatever reason localhost:3000 does not work. The error page states This webpage is not available ERR_CONNECTION_CLOSED However, 127.0.0.1:3000 does work. I have tried making changes to my hosts file, but to no avail. Does anyone have any idea what's causing the problem?
Chrome version is 46.0.2490.80 m
Here are the steps I took to make this work correctly:
Edited my hosts file so 127.0.0.1 localhost. was present, and saved the file
Cleared my Chrome cache, specifically cookies and cached files
Cleared host cache in chrome://net-internals/#dns
Restarted chrome
Alternatively, this also works:
Navigate to chrome://net-internals/#hsts
Under "Delete domain", type localhost and delete
Unbeknownst to me, my project had an HSTS middleware that set an HSTS cookie
For me (I had HTTP and HTTPs dev server on same port)
Chrome Dev tools F12
Application tab
Clear storage sub-tab
"Clear site data" button
I ran into a similar issue on my MacBook but none of the existing answers worked. I even tried the nuclear option and did a factory reset on my computer.
The issue turned out to be coming from the AirPlay receiver listening on Ports 5000 and 7000, which was creating the 403 error when I tried to serve something at localhost:5000.
The solution, as detailed here, was to uncheck AirPlay Receiver in System Preferences > Sharing
I solved my problem by:
opening the developer console F12
Going to network tab
Check Disable Cache
Browse locahost
What you can do is go to Chrome setting > Privacy and Settings > See all the cookies and site data, search for localhost and delete it. Then refresh your site it will be working.
Regards
if you're using a proxy there's a checkbox to bypass it for local addresses.
follow these steps.
open chrome
go to setting
Privacy and security
Clear browsing data
check cookies and other site data
click clear data.
I had same issue and I cleared cookies and cache and it worked
Go to Setting/clearBrowserData and just check all of history, cookies and cached files.
For me, Browse in Private (Ctrl + Shift + N) was enough.
Finally I have solved this problem
For those who have tried the clearing the cache from the browser and still facing the same issue follow these steps
search for live server(ctrl+shift+x) you will find a settings icon. click on Extension
settings
you can find Live server>Settings:Chrome Debugging Attachment click on edit in Settings.json
just add this (if there are multiple lines make sure to add comma[,])
"liveServer.settings.port": 0
Doing This It will randomly pick an opened port each time.

Google Chrome throws -Invalid Server Certificate- for any SSL

Strange problem happening with me for the third time this month, when i restart my pc it's being solved:
Google Chrome throws -Invalid Server Certificate- for any secured website like Facebook or live or even for Gmail.
I'm using the latest version of chrome.
Does anyone have the same problem!
I've found a solution, it's a bug in Chrome happens after the system's hibernate, i solve it without restart by killing the chrome process 'End Process Tree for chrome.exe'
I'm using Windows 7 Home premium, Chrome v18.
Its in news.. Google chrome hit by ssl bug.
http://www.slashgear.com/google-chrome-hit-by-ssl-bug-restricting-google-services-06221921/
We need to wait for security update.
Update:
after checking this bug report. I finally solved it:
You need to follow 2 steps only:
Delete all cache from chrome .
Close the chrome by pressing ctrl +w.
Looks like Chrome did have a bug at one point -
Close the site with cert issue.
Click on 3 dots at the top right to get to settings --> About --> update Chrome - It will ask you to relaunch for the update to take effect.. Accept.
Browse to the site again - if you still have an issue - Verify your certificate using sslshopper or Digicert SSL checkers free tools to make sure your cert is properly installed.