Selenium: Error: WebDriverError: Invalid timeout type specified: ms - selenium

I have a problem using Selenium on IE.
When I run npm run e2e:desktop command, Selenium launch and close immediately an IE page. Then, I got this error:
E/runner - Unable to start a WebDriver session.
E/launcher - Error: WebDriverError: Invalid timeout type specified: ms
I launch this command to install selenium:
webdriver-manager update --standalone=false --chrome=false --gecko=false --versions.standalone=3.4.0 --versions.chrome=2.25
Stack:
IE : 11.0.960019463
Protractor : 5.1.1
Selenium Server Stadalone : 3.141.59
IE web driver : 3.14.0
Any idea?

It seems a bug of protractor 5.0.0+ dependencies. You could try to downgrade protractor from 5.1.1 to 5.0.0. Or you could try the following command to update and start the webdriver manager with a specific version:
webdriver-manager clean
webdriver-manager update --ie --versions.standalone=3.4.0 --versions.ie=3.4.0
webdriver-manager start --versions.standalone=3.4.0
For more information, you could refer to this thread.

Related

WebdriverIO SevereServiceErrror not stopping the test run

I have setup a custom wdio service (as per the documentation) which is used to create a build for the Angles automation dashboard.
As part of this service I want to use the SevereServiceError when it is unable to create the build and stop the run. However in my example test it throws the error and simply continues the test run. See logs here:
2022-03-05T07:28:36.936Z INFO #wdio/cli:launcher: Run onPrepare hook
2022-03-05T07:28:36.936Z INFO chromedriver: Start Chromedriver (/git/angles/webdriverio-example/node_modules/chromedriver/lib/chromedriver/chromedriver) with args --port=9515 --url-base=/
2022-03-05T07:28:36.982Z ERROR #wdio/cli:utils: A service failed in the 'onPrepare' hook
SevereServiceError: Unable to create a build due to connect ECONNREFUSED 127.0.0.1:3000.
at /Users/sergios/Documents/git/angles/webdriverio-example/node_modules/angles-wdio-reporter/src/integrations/wdio/AnglesWDIOService.ts:57:15
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async /Users/sergios/Documents/git/angles/webdriverio-example/node_modules/#wdio/cli/build/utils.js:28:17
at async Promise.all (index 1)
at async Launcher.run (/Users/sergios/Documents/git/angles/webdriverio-example/node_modules/#wdio/cli/build/launcher.js:86:13)
Continue...
2022-03-05T07:28:36.985Z INFO chromedriver: Starting ChromeDriver 98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758#{#1151}) on port 9515
2022-03-05T07:28:36.987Z INFO chromedriver: Only local connections are allowed.
You can run the example yourself by cloning the example repo and running npm run test.
NOTE: This should fail because it's looking for a local instance of the Angles dashboard.
Any ideas why the SevereServiceError isn't stopping the test run?
By updating wdio dependencies and ts-node and typescript to current versions this issue has been resolved. The test run now stops when the SeverServiceError is thrown.

Error: No selenium server jar found at "Location"

I am facing following issue :
Error: No selenium server jar found at
C:\ui-automation\serenity-1.0\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.0.1.jar.
When I am trying to run my test using protractor using following command:
protractor .\protractor.conf.js
This error comes into picture in two scenario :
1. selenium-server-standalone-3.0.1.jar does not exist :
In your project's
"node_modules\protractor\node_modules\webdriver-manager\selenium"
location.
To Resolve this you have to run following command :
webdriver-manager update
2. selenium-server-standalone exists with different version :
In this scenario you have to download the required selenium-server-standalone jar as follow :
webdriver-manager update --versions.standalone "specific_version"
Example :
webdriver-manager update --versions.standalone 3.0.1
OR
node ./node_modules/protractor/bin/webdriver-manager update --versions.standalone 3.0.1

Need to downgrade chromedriver for Protractor to match earlier Chrome version

I am currently trying to get some existing Protractor tests running properly for an app that I will be doing QA work for. However, it looks like I will need to use an earlier version of chromedriver to sync up with the version of Chrome I am using (71.x) but I am not sure how to get Protractor to use a different version as it always downloads v76. Why do I need to do this? Context below.
After pulling the code from the repository, I did an "npm install" in the "/e2e" directory according to the instructions left by the previous dev, as well as updating things through webdriver-manager using "webdriver-manager update." When running Selenium, I got the "Invalid or corrupt jar file" error that is apparently an issue with the 4.0.0-alpha-1 and alpha-2 versions, so I downgraded Selenium to the standalone version 3.141.59.
This worked until I realized that when running the tests, the app didn't recognize the browser as being Chrome and failed the tests (it requires Chrome to run) even though it was definitely running Chrome. So, I had to downgrade my local machine's version of Chrome down to match the chromedriver version that my update pulled - I believe it was running chromedriver v75 and I was running v76 on my local machine.
I was told by a QA colleague that I should be running Chrome v71.x since that is what we are using for our release pipeline. So, I uninstalled Chrome and got Chrome v71.x, making sure that auto-updating was disabled. This means I need to get the version of chromedriver that matches this, which appears to be v2.46 from the digging I did online.
Now, to my core issue. Every time I try to update things through webdriver-manager it always downloads the latest version of chromedriver (v76) and I don't know how to get Protractor to use an earlier version. I have downloaded chromedriver 2.46 manually - I am guessing I need to point it to this version somehow, but messing with the config json files has not yielded any luck for me and I haven't found a good answer online.
Any help is appreciated as I am still new to how all this works.
For reference, this is the type of error that pops up when I try to run my specs:
[08:25:41] E/launcher - SessionNotCreatedError: session not created: This
version of ChromeDriver only supports Chrome version 76
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-
14T08:25:53'
System info: host: 'xxxxxxxx', ip: 'xxxxxxxx', os.name: 'Windows
8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
Driver info: driver.version: unknown
Your npm module will have folder as webdriver-manager. Here all binary ex chromedriver will be present.
Location:
/node_modules/protractor/bin/webdriver-manager
Now do below steps
Do webdriver-manager update
Now goto that folder and delete the chromedriver binary as per your OS i.e chromedriver.exe(Windows) and replace with
it downgrade version of same which you will download from here, make sure name of the exe should be same as before Click
Here
Run your test now
OR
To download a specific version of (for example) chromedriver:
webdriver-manager update --versions.chrome 2.46
webdriver-manager start --versions.chrome 2.46
This is very often issue, I solve this by checking what is the version of my local chrome, and then I just update to that version in package.json and then do npm i. Updating webdriver-manager does not solve the problem for me, it downloads the proper chrome binary but doesnt use it. So "npm i" solves it for me.
So my need was to do this programmatically as part of our build process. We use Jenkins for our CI process.
This is what the relevant section of our Jenkinsfile looks like. The matching driver version is installed after the npm install using webdriver-manager update. The grep statement is capturing the first three fields of the browser version. This is needed to append to the chromedriver url to return the four field version of the matching driver.
...
stages {
stage('Install') {
steps {
sh 'google-chrome --version'
sh 'npm --version'
sh 'node --version'
sh 'yes | npm i'
script {
env.chromeVersion = sh (
script: "google-chrome --version | grep -Po 'Chrome \\K[^\\.](\\d+\\.){2}\\d+'",
returnStdout: true
).trim()
}
echo "chromeVersion: ${env.chromeVersion}"
script {
env.chromeDriverVersion = sh (
script: "curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${env.chromeVersion}",
returnStdout: true
).trim()
}
echo "chromeDriverVersion: ${env.chromeDriverVersion}"
sh ("./node_modules/webdriver-manager/bin/webdriver-manager update --versions.chrome ${env.chromeDriverVersion}")
}
}
...
The other critical piece was to update the test run to direct Protractor to not update the driver after it had been installed. This is the relevant part of our package.json
{
"name": "ourProduct",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"e2e": "ng e2e --webdriverUpdate=false"
},
Then later in our Jenkinsfile, we are running the tests.
...
stage('Run Tests') {
steps {
sh 'npm run e2e'
}
}
...

Protractor installed in offline mode - error for webdriver-manager start - what am I doing wrong

I need to install and use Protractor / Selenium on the machine without Internet access.
To do that, I've tried to download all needed files and copy them to the destination machine.
On my machine (with Internet access)
I installed Protractor and Selenium webdriver with the following command:
npm install -g protractor
webdriver-manager update
On destination machine (without Internet access)
I copied all files from the location returned by npm config get prefix to the computer without Internet access.
Then I executed following command on the machine without Internet access:
npm --cache-min 9999999 install -g protractor
which seems to succeed.
However, when I try to execute webdriver-manager start command, I receive following error message:
events.js:183
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND chromedriver.storage.googleapis.com
chromedriver.storage.googleapis.com:443
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
I receive the same error when executing webdriver-manager update (as in this case: webdriver-manager start: Error: connect ETIMEDOUT)
Question
What am I doing wrong? How should I properly setup Protractor and webdriver on the machine without Internet access?
Because webdriver-manager start will look up the latest version number of selenium-server.jar and webdriver binaries through internet no matter they are already exists on local.
But webdriver-manager not supply cmd option to disable the looking up.
The quick way is to run the java cmd behind webdriver-manager start directly to skip the looking up.
java
-Dwebdriver.chrome.driver=C:\Tools\npm-global\node_modules\webdriver-manager\selenium\chromedriver_2.38.exe
-Dwebdriver.gecko.driver=C:\Tools\npm-global\node_modules\webdriver-manager\selenium\geckodriver-v0.20.1.exe
-jar C:\Tools\npm-global\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.11.0.jar
-port 4444
The complex way is to change webdriver-manager code or setup a mirror on local and use cmd option: --alternate_cdn and point it to your local mirror url. ( I didn't verify this can work, get it after read some source code)

webdriver manager not working behind proxy

I need to use webdriver-manager to execute:
webdriver-manager update --proxy=https://proxy.company.com:8080
But get
webdriver-manager: using local installed version 12.0.6
events.js:160
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:1020:11)
at TLSWrap.onread (net.js:568:26)
i.e. the proxy command still does not seem to work for 12.0.6 for me.
What worked for me was adding --ignore_ssl in addition to --proxy
webdriver-manager update --proxy=http://someproxy:8080 --ignore_ssl
As question title sounds if-you want to use webDriver manager being behind proxy then use it like below in your browser instantiation class-
WebDriverManager.chromedriver().proxy("YourProxyServerUrl:YourPort").setup();
driver = new ChromeDriver(chromeOptions-if you have);
And if you looking for:updating the selenium webdriver using the "webdriver-manager
Refer below thread -
selenium webdriver manager update - npm