Chrome getting crashed randomly even after chromedriver - python-3.x

I have a Selenium automation script which was working fine with Chrome v.58, but after the upgrade, my test cases keeps on failing randomly due to the issue chrome not reachable.
I have checked the chromedriver log file and found out the request to init is failing. Can someone please help me out to solve this.
[1.961][INFO]: Launching chrome: "C:\Program Files
(x86)\Google\Chrome\Application\chrome.exe"
--disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-infobars --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --enable-precise-memory-info --ignore-certificate-errors --js-flags=--expose-gc --load-component-extension="C:\Users\prateek.rajendra\AppData\Local\Temp\Mxt94\tmp\scoped_dir10588_12332\internal"
--log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12666 --safebrowsing-disable-auto-update --start-maximized --test-type --use-mock-keychain --user-data-dir="C:\Users\prateek.rajendra\AppData\Local\Temp\Mxt94\tmp\scoped_dir10588_26250"
data: [58.967][DEBUG]: DevTools request failed [59.028][DEBUG]:
DevTools request: http://localhost:12666/json/version

This is a common got you in the Selenium world. You need to update your chromedriver also and your issue will get fixed.
If I understand correctly currently you have updated the chrome browser but have not update chromedirver. Just go to Selenium website and download the latest driver and your issue will vaporise.
Best,

Related

Selenium, VBA - ERR_PROXY_CONNECTION_FAILED with chromedriver update 86.0.4240.111

It's been working fine until the latest chrome update. As usual I downloaded the latest Chromedriver update to complement the newest release of chrome but now I'm getting the following error once it tries to open a page.
I'm using a proxy so initially I launch chrome without the proxy to ensure there is no connection without proxy, then I launch Putty and connect the proxy server. This has all worked seamlessly until this latest update.
I've included a section of my code below:
Public Driver As New WebDriver
Set Driver = New ChromeDriver
Driver.SetProfile Sheets("Settings").Range("B52").Value
Driver.AddArgument ("--proxy-server=socks5://localhost:1194")
'Set download directory
Driver.SetPreference "download.default_directory", Sheets("Settings").Range("B44").Value
Driver.Get "https://www.google.co.uk/", timeout:=none ', False
If Driver.FindElementsByXPath("//*[contains(text(),'The proxy server is refusing connections')]").Count Or Driver.FindElementsByXPath("//*[contains(text(),'There is something wrong with the proxy server')]").Count Then
Open_Putty_and_Connect_to_Host_Network
end if
Error occurs at driver.get
Full Error Message:
Run_time error '13':
UnknownError
unknown error: net::ERR_PROXY_CONNECTION_FAILED
(Session info: chrome=86.0.4240.111)
(Driver info: chromedriver=86.0.4240.22)
(398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/424
NT 10.0.18362 x86_64)
I've been looking online and what I can see I need to pass an argument to the chrome driver but I'm not sure how to or what I need to pass to it.
The code will run beyond this point normally and connect to the proxy and perform it's standard function but I can't understand why this error is occurring or how to fix it. Any help would be greatly appreciated!

get chrome app console logs in chrome os debug log

I've got a chrome app with several isolated layers (webviews, iframes), all those layers are logging some debugging stuff to console with console.log().
I managed to get all console logs inside a chrome debug log when launching chrome on mac os with --enable-logging --v=1 flags.
The problem is I can't get all the console.logs when running the app in chrome os. For chrome os debugging I wrote the following into /etc/chrome_dev.conf file:
CHROME_LOG_FILE=/tmp/chrome_debug.log
--enable-logging --v=1
So I expect pretty much the same logs as I get when running chrome app on mac os, but I do not see any console.logs in /tmp/chrome_debug.log.
Would appreciate any advice how to get my app console.logs in chrome debug log on chrome os
Please read the comments in the /etc/chrome_dev.conf file, particularly this one at the top:
# This file may be modified to make local changes to the environment and command
# line that session_manager uses to run Chrome. It contains one directive per
# line, with the following forms available:
That means your --enable-logging --v=1 is incorrect because you put two options on one line instead of one option per line.

Chrome canary headless mode does not work on windows10

Google Chrome Canary does not work with headless on Windows.
Chrome headless does not work on windows.
The Error happens like following when I tried to execute below code.
But it works on non-headless mode.
I know Canary is unstable but I want to using it to learning about web advanced spec.
This error caused by bug in canary?
Or caused by my code?
code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
op = Options()
op.binary_location = "C:\\Users\\username\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe"
op.add_argument("--headless")
op.add_argument("--disable-gpu")
driver = webdriver.Chrome("chromedriver.exe", chrome_options=op)
driver.get("http://www.google.com")
Error:
[1205/232511.644:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
[1205/232511.644:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.644:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
DevTools listening on ws://127.0.0.1:12022/devtools/browser/3d7c8ff8-625a-4326-b968-bbff
[1205/232511.714:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.714:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
[1205/232511.714:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.714:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
[1205/232513.037:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232513.037:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
OS: windows 10 Home 1709
Chrome: 65.0.3285.0 (Official Build) canary 64bit
ChromeDriver: 2.33.506120
As your error logs reports as follows :
[1205/232511.644:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
[1205/232511.644:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.644:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
I will suggest the following steps :
Uninstall Google Chrome Canary from your system through Revo Uninstaller
Use CCleaner tool to wipe off all the OS chores.
Install fresh Google Chrome Canary
Use the following code block :
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
op = Options()
op.binary_location = "C:\\Users\\username\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe"
op.add_argument("--headless")
op.add_argument("--disable-gpu")
driver = webdriver.Chrome(chrome_options=op, executable_path=r'C:\path\to\chromedriver.exe')
driver.get("http://google.com/")
You can find about multiple ways to work with multiple Chrome Browser Binaries in Set chrome browser binary to chrome webdriver in Python discussion.

Running protractor tests on IE 11

OK, so I have been searching a lot to get proper solution to the blocker I am facing right now. Let me give you a background of what I have done so far :
I want to run protractor tests (located on Linux machine) on IE 11 of Windows Server 2012 R2 (IP : 10.81.73.248). My protractorTest.conf.js has below :
exports.config = {
seleniumAddress: 'http://10.81.73.248:4444/wd/hub',
baseURL: 'http://10.81.78.137:80000/',
capabilities: {
browserName: 'internet explorer',
platform: 'ANY',
version: '11'
},
On my Windows Server 2012 R2 machine, I've downloaded IEDriverServer_Win32_2.47.0 and placed it under C:\Windows\System32, environment variable PATH has been updated with above location. Protected mode settings are same for all zones. Windows machine also has selenium-server-standalone-2.48.2.jar placed under C:\Users\Selenium.
On Windows machine, I am starting selenium server using below command :
java -jar selenium-server-standalone-2.48.2.jar -port 4444 -Dwebdriver.ie.driver="C:\Windows\System32\IEDriverServer_Win32_2.47.0\IEDriverServer.exe" , which starts selenium server fine.
With above settings, I run protractor tests from my Linux machine using grunt protractor_test, which launches IE browser on Windows machine, shows localhost:dynamic port and a message as : This is the initial page of webdriver server and within 2 seconds, closes the browser.
The exception I get on selenium server terminal is as below :
Session ID is null. Using WebDriver after calling quit() ?
This is where I am stuck at. I looked at various posts which describes similar issue (?) as mine along with the potential solution, but I am unable to resolve my issue here.
Is there anything I might be doing wrong to setup the connections ? or am I missing some steps to get me through ?
I would really appreciate if you guide me in resolving this long time pending blocker.
I think you are trying to run using old selenium version.It should be 2.53.x something.
Few basics things to check first regarding IE execution:
1).IE Setting for protractor(Selenium)
http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/
2).Take IE driver of 32 bit(don't take 64 it has known slowness issues) and manually copy on the following path:
Root Folder\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1
3). IE Driver can be downloaded from following path:
http://selenium-release.storage.googleapis.com/index.html?path=2.53/
**OR**
Please upgrade your protractor version to latest like 4.0.11 by changing the version in package.json file and do from command prompt(inside project root directory):
npm update
and then give update your selenium driver with following command from command prompt
webdriver-manager update --ie
it will update the selenium version of IE driver to latest and then try running your tests again.

Selenium Grid - Webdriver - Whitescreens when running tests

So typically I do these steps to run a test
Start selenium grid (java -jar selenium-server-standalone-2.39.0.jar -role hub // java -jar selenium-server-standalone-2.39.0.jar -role node)
Run a test script (node test.js // nightwatch test.js | node test.js)
Webdriver kicks off browser and starts test
These scripts used to work and after revisiting them after a couple months I found they are now broken. I am unsure what the problem is as I have not changed any code. Any help is greatly appreciated.
FYI
Selenium version: 2.39.0 |
OS: Mac Yosemite |
Browser: Firefox |
Browser version: 34.0.5
After 'starting' the server and going to
http://localhost:4444/
i get
"You are using grid 2.39.0
Find help on the official selenium wiki : more help here
default monitoring page : console"
but when trying to run a night watch script or even 'nightwatch help' it fails and then gives me the error - 'Connection refused! Is selenium server started?' (node scripts also give me a white screen)
Turns out this webdriver doesn't like the newer versions of firefox.
If you are experiencing issues go grab Firefox v 28.0 https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/mac/en-GB/

Resources