Selenium shows java.net.SocketException: Connection reset - eclipse

I have searched for the solution but I have not found the solution I always get this error
codigo :
public static void main(String [] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Ofima\\workspace\\OfimaWeb\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("http://ofimawebbeta.ofima.com/");
driver.manage().window().maximize();
driver.getTitle();
}
Error :
Starting ChromeDriver (v2.9.248315) on port 41785
ene 19, 2018 9:48:49 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMACIÓN: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:37:19.049Z'
System info: host: 'PCPOF-021', ip: '10.72.4.128', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
at OfimaWeb.cartera.main(cartera.java:23)
Caused by: java.net.SocketException: Connection reset

The error does gives us some hint as follows :
org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Which essentially implies that ChromeDriver binary is unable to spawn a new Chrome Browser process.
Your main issue is the version compatibility among the binaries you are using as follows:
You are using ChromeDriver v2.9 (released 2014-01-31)
Release Notes of ChromeDriver v2.9_ clearly mentions the following :
Supports Chrome v31-34
You mentioned of using latest Chrome. I suppose it is chrome=65.x
You are using Selenium Version 3.8.0 (released 2017-11-30T11:37:19.049Z) [as per the error stack trace within your question]
So there is a clear mismatch between requirement for ChromeDriver v2.9 and the Chrome Browser version you are using. Hence ChromeDriver is unable to spawn the new Chrome Browser process.
Solution
Update ChromeDriver to current v2.35 level.
Downgrade Chrome to stable Chrome v64.x levels. (as per ChromeDriver v2.35 release notes)
Upgrade Selenium to current levels Version 3.8.1.
Clean and Re-Build your project through your IDE.
Clear the Browser Cache
Use CCleaner tool to wipe off all the OS chores.
If your Web Browser base version is too old, uninstall the Web Browser through Revo Uninstaller with Moderate Scan and install a recent GA Released version of the Web Browser.
Execute your #Test.

Download ChromeDriver from
http://chromedriver.storage.googleapis.com/index.html?path=2.33/
This ChromeDriver shall work with your version of Google Chrome.

Related

Webdriver manager downloads the latest version of chrome driver which is not supported for the latest chrome version for windows

I have the following piece of line in my package.json -
"webdriver-manager": "^12.1.7",
And when my protractor code runs in jenkins pipeline it throws me an error -
[01:11:30] I/testLogger - [chrome #01-12] PID: 12008
[chrome #01-12] Specs: C:\coco-e2e-5-2-2021\coco-web-client\apps\coco-e2e\outputFiles\JSFiles\view-comms-docs-tbs\view-comms.spec.js
[chrome #01-12]
[chrome #01-12] [01:11:29] I/direct - Using ChromeDriver directly...
[chrome #01-12] [01:11:30] E/runner - Unable to start a WebDriver session.
[chrome #01-12] [01:11:30] I/runnerCli - session not created: This version of ChromeDriver only supports Chrome version 90
[chrome #01-12] Current browser version is 89.0.4389.128 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[chrome #01-12] (Driver info: chromedriver=90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430#{#429}),platform=Windows NT 10.0.18363 x86_64)
What I see from Chrome driver's official release is, the latest chromedriver version is 90.0.4430.24.
But the latest chrome version for windows is 89.0.4389.128. And this is what causing the mismatch.
There's a chrome version 90.0.4430.66 released on 14th April, 2021 but that's compatible with Android chrome and not with windows chrome.
Now how do I tweak my code so that it will not take the chromerdriver v89.0.4389.23 instead of v90.0.4430.24?
The protractor test will not run locally but on a different system via jenkins. So updating chromedriver locally may solve my problem for debugging but not for running the test in the pipeline.
Any leads are very much appreciated. Thanks in advance.
what you actually need to do is to match a version of your local chrome to the version of chromedriver (the driver is the layer that controls your browser, so it's important to make them correspond to each other). So
First, find out what your version of chrome is. For example, it is 86.0.4240.111
Then, find out what chromedriver version can be used. Take the major version of the browser (first 3 numbers, 86.0.4240 in this case) and find the corresponding version of the driver by going to this url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} (put the major browser version instead of ${CHROME_VERSION}). You'll see the chromedriver you're looking for is 86.0.4240.22
This is where the trickiest part begins. There are 2 installation of protractor usually:
local
global
I won't go over how to find which one you use, you can look it up. But when you find it, make sure you're updating the right one
When you know which protractor you're updating, go to it's folder and from that folder run npm i webdriver-manager#latest and then node ./bin/webdriver-manager update --gecko=false
when you updated the right webdriver, install the right chromedriver like so
node ./bin/webdriver-manager update --gecko=false --versions.chrome $VERSION
Make sure to put 86.0.4240.22 instead of $VERSION

SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85

Currently i am working protractor UI testing. My testcase is working properly so far, but suddenly it shows a webdriver problem. My current chrome version is 84. But the selenium driver is expecting version 85. Version 85 is still not released.
[14:56:46] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 85
(Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183#{#779}),platform=Windows NT 10.0.17134 x86_64)
[14:56:46] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 85
(Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183#{#779}),platform=Windows NT 10.0.17134 x86_64)
Either use webdriver-manager to specify your chromedriver version or use --webdriverUpdate=false if running e2e tests
(see: https://github.com/angular/protractor/issues/5460)
There seems to be an issue where webdriver-manager is installing ChromeDriver 85 even though Chrome 84 is the current stable release. Multiple people have reported this issue.
I've posted a workaround in issue 376
Overall, you temporarily can hardcode the version you want when using webdriver-manager, then tell protractor which version to use (since protractor can still try to install 85 and use it).
Here is the copied work-around:
We have webdriver-manager installed as project dependency (npm install --save-dev webdriver-manager)
we call webdriver-manager update --versions.chrome 84.0.4147.30 prior to running our tests. This will install the 84 chromedriver version in ./node_modules/webdriver-manager/selenium/. (We just made this as a npm script in our package.json)
We then update the protractor.conf file to have this line in the root of exports.config: chromeDriver:"./node_modules/webdriver-manager/selenium/chromedriver_84.0.4147.30.exe"**
Protractor still installs chromedriverr 85, but it will use the 84 version.
** In our case, we run our protractor tests in docker, but develop mostly on windows. So I updated the protractor.conf to have this line so that it works in either:
chromeDriver: process.platform === "win32" ? "./node_modules/webdriver-manager/selenium/chromedriver_84.0.4147.30.exe" : "./node_modules/webdriver-manager/selenium/chromedriver_84.0.4147.30"
I have had the same issue but it worked when I updated latest version of protractor which is 7.0.0

Original error: Could not find 'aapt.exe'

I am having hte below error when i try to open an app using appium
org.openqa.selenium.SessionNotCreatedException: Unable to create a new
remote session. Please check the server log for more details. Original
error: An unknown server-side error occurred while processing the
command. Original error: Could not find 'aapt.exe' in
["C:\Users\nsingh163\Desktop\Naresh Folder\Automation\Mobile
Automation\Downloads\Android-sdk\platform-tools\aapt.exe","C:\Users\nsingh163\Desktop\Naresh Folder\Automation\Mobile
Automation\Downloads\Android-sdk\emulator\aapt.exe","C:\Users\nsingh163\Desktop\Naresh
Folder\Automation\Mobile
Automation\Downloads\Android-sdk\tools\aapt.exe","C:\Users\nsingh163\Desktop\Naresh
Folder\Automation\Mobile
Automation\Downloads\Android-sdk\tools\bin\aapt.exe"]. Do you
have Android Build Tools installed at
'C:\Users\nsingh163\Desktop\Naresh Folder\Automation\Mobile
Automation\Downloads\Android-sdk'? Build info: version: '3.141.59',
revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
'USD4FWTN2', ip: '10.88.4.6', os.name: 'Windows 10', os.arch: 'amd64',
os.version: '10.0', java.version: '1.8.0_171' Driver info:
driver.version: AndroidDriver
I have tried installing Android SDK again but still not able to find aapt.exe in hte tools folder
I am quite new to the mobile automation but I encountered this issue and how I managed to fix it...
aapt.exe is actually not in the "tools" folder :), you have to get "build-tools" folder and there you can find it
in cmd or whatever you are using, you can enter this command (bare in mind that the version is just as an example, I think that it has to match platform-tools you installed previously)
sdkmanager "build-tools;28.0.0"
So, once you have the build-tools folder, just go there and copy aapt.exe from there to the "tools" folder
To resolve this issue, below are the steps:
1. Find API level for your phone/ device. Setting -> About device -> Software Info -> Note down Android Version. -> Goto https://en.wikipedia.org/wiki/Android_version_history
from here, find out API Level for your Android Version.
2. Navigate to sdkmanager.bat path in CMD (\sdk-tools-windows-4333796\tools\bin) and use "sdkmanager "build-tools;21.0.0" to download build-tools for API level 21, change it as per your API level.
3. Once done, copy aapt.exe file from build-tools folder to platform-tools folder.
This should resolve the issue.

getting an error on trying to launch Chrome using Protractor

I'm trying to launch the browser through Protractor. I downloaded webdriver through terminal by giving webdriver-manager update command. This is downloading the latest chromedriver v74, but the chrome browser is v73.
How to explicitly set the WebDriver version?
I'm getting the following error:
[11:09:13] E/driverProvider - Error code: 135
[11:09:13] E/driverProvider - Error message: session not created: This version of ChromeDriver only supports Chrome version 74
[11:09:13] E/driverProvider - Error: session not created: This version of ChromeDriver only supports Chrome version 74
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Mac OS X 10.14.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.70 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Acsahs-MBP', ip: 'fe80:0:0:0:45:3f89:2e8b:ab96%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_191'
Driver info: driver.version: unknown
at Local.<anonymous> (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:69:23)
at Generator.throw (<anonymous>)
at rejected (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:5:65)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
[11:09:13] E/launcher - Process exited with error code 135
My config file:
exports.config = {
seleniumaddress:'http://localhost:4444/wd/hub',
specs:['spec.js']
};
is it solved yet? if not then try this.
for my small selenium-webdriver test i did these steps after i researched online and here:
npm install selenium-webdriver
npm install chromedriver
npm install geckodriver and opened file library.js and npm init and ran node library.js (source code below)
Error: (node:14212) UnhandledPromiseRejectionWarning: NoSuchSessionError: invalid session id Some long error related to not same chromedriver version. so i checked the chrome browser version manually in the browser. it was version 73 and my mistake i had downloaded chromedriver version 74.0.
so go to https://chromedriver.storage.googleapis.com/index.html?path=73.0.3683.68/ download according to your OS and download it in ~/Downloads .
then in open terminal in the ~/Downloads folder.
then USER#DESKTOP:~/Downloads$ unzip ~/Downloads/chromedriver_linux64.zip -d ~/Downloads You will get the raw chromedriver file in ~/Downloads folder.
now i moved the ChromeDriver 73.0.3683.68 file to two places - usr/local/bin and usr/bin in my system.
there was already a chromedriver file in usr/local/bin .
to move the file - USER#DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/local/bin/chromedriver and USER#DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/bin/chromedriver you are saying you want to move the file chromedriver from first location to other means replacing any files already in those locations with same name.
Last all i did was. close the vscode and relaunched it. and ran my code node library.js . and it worked it the chrome browser for me.
TOOK AN HOUR FOR ME TO GO THROUGH AROUND 35-40 STACK-OVERFLOW AND RANDOM ONLINE RESOURCES/QUESTION-ANSWERS BUT WAS WORTH IT. :)
SOURCE CODE : LIBRARY.JS
var webdriver = require('selenium-webdriver');
var By = webdriver.By;
var until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('chrome').build();
driver.get('https://www.google.com');
Add this as a script to your package.json file
"scripts": {
"protactorInstall": "cd ./node_modules/protractor && npm i webdriver-manager#latest"}
use
npm run protactorInstall
to execute the script.
Try the below command from terminal to install particular version
webdriver-manager update --versions.chrome 2.46
Hope it helps you

Getting "iDeviceInstaller" error even when ideviceinstaller is installed on my mac

I am using mac OSX El Capitan. I have installed eclipse Neon in it. I have a full setup of running selenium scripts using appium on real ios device. For this i have "ideviceinstaller" also installed. I created a project in a workspace to launch an app on the device and it is working fine. But when i copied the same code to different project, it starts giving me the error
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 33.97 seconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'MacBookBL9138C.local', ip: '10.104.150.28', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_73'.
I tried by uninstalling the current eclipse and installing eclipse lunar, but its still failing. I tried running same code in new workspace, but still same error.
Any help will be appreciated.
I think i have found the answer for this one. I missed to configure the path in eclipse.
For refer the below link for answer:
https://discuss.appium.io/t/error-could-not-initialize-ideviceinstaller-make-sure-it-is-installed-and-works-on-your-system/11699/5?u=tuhuynh