Selenium WebDriver: Connection refused (Connection refused) - node.js

I'm running npm test on mean.js version 4.2 and it's giving me a "connection refused" error on the protractor e2e tests. I tried updating selenium like this says to. Right now it's version 2.27 and the other Stack Overflow post says 2.24. Did the chrome driver break again?
Running "protractor:e2e" (protractor) task
webdriver-manager path: /Users/tdiddy/meaning42/node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager
selenium standalone is up to date.
chromedriver is up to date.
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.30:53658/wd/hub
/Users/tdiddy/meaning42/node_modules/grunt-protractor-runner/node_modules/selenium-webdriver/lib/atoms/error.js:108
var template = new Error(this.message);
^
UnknownError: Connection refused (Connection refused)
at new bot.Error (/Users/tdiddy/meaning42/node_modules/grunt-protractor-runner/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)

In this context, to answer your question, I believe chromedriver 2.27 is not used...this is why:
"Selenium standalone server started at http:" means that you have started the selenium standalone server with the local driver provider. When you start Protractor version 4 (grunt-protractor-runner uses Protractor version ^4.0.0) with a local driver provider, the chromedriver used is the version stated in the webdriver-manager's configuration. Just because you download 2.27 does not mean that Protractor will use Protractor 2.27 when launching locally.
There are two ways to use chromedriver 2.27:
You'll need Protractor 5 to use the last downloaded binary when launching a local driver provider. Download chromedriver 2.27 with webdriver-manager update --versions.chrome 2.27 then launch your Protractor test.
Do not use the local driver provider. Download your binaries with webdriver-manager update --versions.chrome 2.27 then launch your selenium standalone server with webdriver-manager start --versions.chrome 2.27. Once you have started that, launch it with seleniumAddress: "http://localhost:4444/wd/hub" in your configuration.
Why you are getting Connection refused could be because the Chrome version you are running at the chromedriver version you are using are not compatible. I would suggest trying a combination of the two suggestions: use a seleniumAddressin your configuration with Protractor 5.0.0. If this combination fails, please feel free to open up an issue.

I was getting this error and updating chromedriver to v2.32 via brew (brew update chromedriver) fixed it for me

Related

Install chrome driver on Amazon Linux 2 ARM

I am looking to install Chrome Driver (For my selenium project) on an Amazon Linux 2 (Arm 64).
I have done this on Ubuntu and seems pretty straight, it also seems straight on AL2 x86, like this script from Intoli but it 404 when looking for Chrome on ARM :(. So far I see Chrome is not available for ARM so I see the alternative is to use Chromium.
I tried installing it manually but it seems there is no compiled on Chromium downloads page for ARM.
Finally i found the Electron's unofficial webdrivers, which seem to be the answer, and after downloading, installing dependencies (libXcursor, libXfixes, libXdamage) and running it:
[ec2-user#scraping1 current]$ chromedriver
Starting ChromeDriver 100.0.4896.143 (6bf1afe83487405ea0aff37182f05e3db45559c2-refs/branch-heads/4951#{#831}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
And run my project I get:
2.7.3 :004 > Selenium::WebDriver::Service.driver_path = "/usr/bin/chromedriver"
=> "/usr/bin/chromedriver"
session = Capybara::Session.new
Webdrivers::BrowserNotFound: Failed to find Chrome binary.
Which means i don't have Chrome installed, but then how to install it? I have seen this question which seems to be my same problem but it is unclear to me how to install Chromium; I see it is needed to download and use the chromedriver compiled for ARM64 which I have done already.

Unable to launch Chrome browser through Selenium in Jenkins on Linux platform

Jenkins is showing message starting the chromedriver but the chromedriver is not triggered and testcase fails.i dont know why it is happening
Note: the xml created for this code runs successfully on terminal.i think issue is with chromedriver
SELENIUM CODE:
public class cmddd {
#Test
public void f() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "/home/dev2/Downloads/newchromedriver/chromedriver");
WebDriver m = new ChromeDriver();
m.get("https://www.google.com/");
System.out.println("passed");
}
}
JENKINS OUTPUT:
Building in workspace /home/dev2/eclipse-workspace/seffcon
[seffcon] $ /bin/sh -xe /tmp/jenkins170843147783066328.sh
+ ./cd.sh
[TestNG] Running:
/home/dev2/eclipse-workspace/seffcon/cd.xml
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
===============================================
Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
Build step 'Execute shell' marked build as failure
Finished: FAILURE
This error message...
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.40
Release Notes of chromedriver=2.40 clearly mentions the following :
Supports Chrome v66-68
Possibly you are using the latest Chrome Browser i.e. chrome=72.0
As per ChromeDriver - WebDriver for Chrome:
If you are using Chrome version 73, please download ChromeDriver 73.0.3683.20
If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
If you are using Chrome version 71, please download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137
For older version of Chrome, please see this discussion for the version of ChromeDriver that supports it.
Solution
Upgrade Chrome version to Chrome v72 level.
As per ChromeDriver - WebDriver for Chrome upgrade ChromeDriver to ChromeDriver v2.46 or ChromeDriver 72.0.3626.69.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
Check your chromedriver version and chromebrowser version. I had noticed this behaviour when there is a version mismatch.
You can refer this link http://chromedriver.chromium.org/downloads

Selenium script execution on Linux vm with Chrome (60 and above version), Firefox(50 or above), internet explorer

While executing the script in linux vm, getting unsupported driver exception for chrome 60 version and firefox 52 version.
The unsupported driver exception suggests that the Selenium WebDriver version and the browser version are incompatible. You will need to either upgrade or downgrade the version of either Selenium WebDriver or your browser.

Protractor 2.28 - headless Chrome 57 - linux - tests failed

I am trying to run protractor tests with jenkins, but I couldn't get it working.
The tests are started but all fails with one of the following exceptions:
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: content shell=)
(Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 4.4.0-22-generic x86_64)
or
Failed: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
The mentioned git issue doesn't help me.
All of them are running well local on a windows 10 machine.
The used versions local and on with jenkins are:
protractor: 5.1.1
chrome: 57.*
chromedriver: 2.28
I have found some issues that chrome should be downgraded to version 55.* but the all didn't solve my problem.
Thank you in advance
It says window.angular is undefined.
I assume it is not an angular site.
Have you tried entering
Browser.ignoreSynchronization = true
Before you get the browser.

Selenium WebDriver Firefox connect error for Linux OS

I have tried all solution suggested by Google. But still struggling to below issue. I have setup of PHPUnit-Selenium based automation framework using headless Firefox on RedHat Linux
Selenium Log Error :
Caused by: org.openqa.selenium.WebDriverException: Failed to connect
to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output
follows: Error: no display specified Error: no display specified
So far I tried:
updated version of selenium driver
updated version of firefox
various selenium-firefox combinations using older versions
Xvfb working fine
Please also let me know :
How i can verify firefox on port 7055 ?
Is etc/hosts file can have cause of this issue ?

Resources