Open davidzaque opened 5 years ago
I'm having this same issue! :(
@sborland I solved this in my own way by changing the standalone-response.xml and update-config.json files. But this link can help you in a better way: https://stackoverflow.com/a/55836347
@davidzaque thanks! This work around worked for me.
@davidzaque I have the same issue. But I don't want to install selenium globally. My angularjs application has protractor in its node module and protractor has it's own dependencies where web driver gets updated to latest. How to install it specifically to protractor and not globally?
Yup this is a bug. This appears to affect every version of the selenium server.
Here is the bug listed in webdriver-manager https://github.com/angular/webdriver-manager/issues/370
And here is the fix / discussion for the fix: https://github.com/angular/webdriver-manager/pull/371
I will get a new release out tomorrow.
as a temporary solution to this issue you can explicitly set the standalone version when running webdriver. --versions.standalone=3.9.1
While running test-cases over protractor , this solution couldn't helping me out. How to use this workaround with protractor ?
i have only tested the solution with our current setup. But when looking at the official docs http://www.protractortest.org/#/
I would run
I hope this helps you in any way.
@tomreinartz90 i had tried. Webdriver starts successfully over port 4444 but getting the error when running protractor conf.js
[15:28:48] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[15:28:50] E/launcher - Cannot define class using reflection
[15:28:50] E/launcher - WebDriverError: Cannot define class using reflection ```
@ZehraHN I found that when I used version 3.141.0, i'm no longer running into that issue. Anything in the 3.8 or 3.9 range was causing me to get the reflection error.
Yes works now. Thankss @clymerrm
@davidzaque I have the same issue. But I don't want to install selenium globally. My angularjs application has protractor in its node module and protractor has it's own dependencies where web driver gets updated to latest. How to install it specifically to protractor and not globally?
@tejasbhosale i don't use protractor globally. I changed the file: node_modules/protractor/node_modules/webdriver-manager/selenium/standalone-response.xml
excluding references related to version 4.0.0-alpha and in the file:
/node_modules/protractor/node_modules/webdriver-manager/selenium/update-config.json
i made this change:
"standalone": {
"last": "/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar",
"all": [
"/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar"
]
},
After that, I kept these files out of the path node_modules, so they would not be updated, and added the following scripts to package.json:
"scripts": {
"preinstall": "node_modules/protractor/node_modules/webdriver-manager/bin/webdriver-manager clean",
"postinstall": "cp standalone-response.xml ./node_modules/protractor/node_modules/webdriver-manager/selenium/ & cp update-config.json ./node_modules/protractor/node_modules/webdriver-manager/selenium/ & node_modules/protractor/node_modules/webdriver-manager/bin/webdriver-manager update --versions.standalone=3.141.59",
"start": "webdriver-manager start"
},
I know, it was too much maneuvering to solve the problem, but it was how I managed to solve it before any other solution they had posted.
Faced the same issue as npm install is downloading a corrupt jar "selenium-server-standalone-4.0.0-alpha-1.zip.jar" .
Tried installing npm again.
It doesn't have selenium directory itself under webdriver-manager !
Files under webdriver-manager: total 64 -rw-r--r-- 1 root root 1205 Oct 26 1985 gulpfile.js -rw-r--r-- 1 root root 547 Oct 26 1985 config.json -rw-r--r-- 1 root root 2455 Oct 26 1985 README.md -rw-r--r-- 1 root root 1078 Oct 26 1985 LICENSE -rw-r--r-- 1 root root 2699 Oct 26 1985 CONTRIBUTING.md -rw-r--r-- 1 root root 21636 Oct 26 1985 CHANGELOG.md drwxr-xr-x 2 root root 4096 Apr 25 15:08 bin drwxr-xr-x 3 root root 4096 Apr 25 15:08 built drwxr-xr-x 2 root root 4096 Apr 25 15:08 docs drwxr-xr-x 5 root root 4096 Apr 25 15:08 node_modules -rw-r--r-- 1 root root 3650 Apr 25 15:08 package.json
Done with https://github.com/cnishina/webdriver-manager/commit/7dc17ef36e93f71bc63475612e343ffb84efec0f
Also we are not downloading alpha versions since we were previously not downloading beta versions. Please update to webdriver-manager 12.1.2. If you are using Protractor to download webdriver-manager, simply remove the node_modules directory and reinstall or do a npm install -f
. Leaving this open for visibility.
Done with cnishina/webdriver-manager@7dc17ef
Also we are not downloading alpha versions since we were previously not downloading beta versions. Please update to webdriver-manager 12.1.2. If you are using Protractor to download webdriver-manager, simply remove the node_modules directory and reinstall or do a
npm install -f
. Leaving this open for visibility.
@cnishina Thanks for your prompt response on this issue. But my build at Jenkins still failing with same error. Is there anything I can do?
@tejasbhosale Are you caching your node modules directory or workspace? You could clean up your Jenkins workspace and try again. I did a clean install and verified that you should get webdriver-manager@12.1.2 with Protractor 5.4.2 because of https://github.com/angular/protractor/blob/5.4.2/package.json#L29. Could you have a lock file that is set to 12.1.1?
@cnishina Thanks for responding. I suspect similar but clearing workspace didn't work for me. I am going to research more in jenkins config. But good news is it worked on my local env so it must be jenkins. And I checked my project's pakcage.json it is using this version
"protractor": "^5.2.0"
Is that fine? is it still gonna get webdriver 12.1.2?
The below mentioned solution worked for me:
Navigate to :
Step 1:
C:\Users\
Step 2: Reinstall Protractor Globally npm install -g protractor
Step 3: Re run Webdriver-manager update
Step 4: Webdriver-manager start will not throw any errors
I had same issue. It's resolved with updating Protractor from 5.4.1 to 5.4.2. π https://github.com/angular/protractor/issues/5224#issuecomment-486873791
Hello @cnishina , i made "remove the node_modules directory and reinstall or do a npm install -f" but not solved my problem: See bellow:
βββ¬ protractor@5.4.2 β βββ @types/q@0.0.32 β βββ @types/selenium-webdriver@3.0.16 β βββ¬ blocking-proxy@1.0.1 β β βββ minimist@1.2.0 deduped β βββ¬ browserstack@1.5.2 β β βββ¬ https-proxy-agent@2.2.1 β β βββ¬ agent-base@4.2.1 β β β βββ¬ es6-promisify@5.0.0 β β β βββ es6-promise@4.2.6 β β βββ¬ debug@3.2.6 β β βββ ms@2.1.1 β βββ chalk@1.1.3 deduped β βββ¬ glob@7.1.3 β β βββ fs.realpath@1.0.0 β β βββ¬ inflight@1.0.6 β β β βββ once@1.4.0 deduped β β β βββ wrappy@1.0.2 β β βββ inherits@2.0.3 β β βββ¬ minimatch@3.0.4 β β β βββ brace-expansion@1.1.11 deduped β β βββ¬ once@1.4.0 β β β βββ wrappy@1.0.2 deduped β β βββ path-is-absolute@1.0.1 deduped β βββ¬ jasmine@2.8.0 β β βββ exit@0.1.2 β β βββ¬ glob@7.1.3 β β β βββ fs.realpath@1.0.0 deduped β β β βββ inflight@1.0.6 deduped β β β βββ inherits@2.0.3 deduped β β β βββ¬ minimatch@3.0.4 β β β β βββ brace-expansion@1.1.11 deduped β β β βββ once@1.4.0 deduped β β β βββ path-is-absolute@1.0.1 deduped β β βββ jasmine-core@2.8.0 β βββ jasminewd2@2.2.0 β βββ¬ optimist@0.6.1 β β βββ minimist@0.0.10 β β βββ wordwrap@0.0.2 β βββ q@1.4.1 β βββ¬ saucelabs@1.5.0 β β βββ https-proxy-agent@2.2.1 deduped β βββ¬ selenium-webdriver@3.6.0 β β βββ¬ jszip@3.2.1 β β β βββ¬ lie@3.3.0 β β β β βββ immediate@3.0.6 β β β βββ pako@1.0.10 β β β βββ¬ readable-stream@2.3.6 β β β β βββ core-util-is@1.0.2 β β β β βββ inherits@2.0.3 deduped β β β β βββ isarray@1.0.0 β β β β βββ process-nextick-args@2.0.0 β β β β βββ safe-buffer@5.1.2 deduped β β β β βββ¬ string_decoder@1.1.1 β β β β β βββ safe-buffer@5.1.2 deduped β β β β βββ util-deprecate@1.0.2 β β β βββ set-immediate-shim@1.0.1 β β βββ rimraf@2.6.3 deduped β β βββ¬ tmp@0.0.30 β β β βββ os-tmpdir@1.0.2 deduped β β βββ xml2js@0.4.19 deduped β βββ¬ source-map-support@0.4.18 β β βββ source-map@0.5.7 deduped β βββ¬ webdriver-js-extender@2.1.0 β β βββ @types/selenium-webdriver@3.0.16 deduped β β βββ selenium-webdriver@3.6.0 deduped β βββ¬ webdriver-manager@12.1.1 β βββ adm-zip@0.4.13 β βββ chalk@1.1.3 deduped β βββ¬ del@2.2.2 β β βββ¬ globby@5.0.0 β β β βββ¬ array-union@1.0.2 β β β β βββ array-uniq@1.0.3 β β β βββ arrify@1.0.1 β β β βββ¬ glob@7.1.3 β β β β βββ fs.realpath@1.0.0 deduped β β β β βββ inflight@1.0.6 deduped β β β β βββ inherits@2.0.3 deduped β β β β βββ¬ minimatch@3.0.4 β β β β β βββ brace-expansion@1.1.11 deduped β β β β βββ once@1.4.0 deduped β β β β βββ path-is-absolute@1.0.1 deduped β β β βββ object-assign@4.1.1 deduped β β β βββ pify@2.3.0 deduped β β β βββ pinkie-promise@2.0.1 deduped β β βββ is-path-cwd@1.0.0 β β βββ¬ is-path-in-cwd@1.0.1 β β β βββ¬ is-path-inside@1.0.1 β β β βββ path-is-inside@1.0.2 β β βββ object-assign@4.1.1 deduped β β βββ pify@2.3.0 β β βββ¬ pinkie-promise@2.0.1 β β β βββ pinkie@2.0.4 β β βββ rimraf@2.6.3 deduped β βββ glob@7.1.3 deduped β βββ ini@1.3.5 β βββ minimist@1.2.0 deduped β βββ q@1.4.1 deduped β βββ¬ request@2.88.0 β β βββ aws-sign2@0.7.0 β β βββ aws4@1.8.0 β β βββ caseless@0.12.0 β β βββ¬ combined-stream@1.0.7 β β β βββ delayed-stream@1.0.0 β β βββ extend@3.0.2 β β βββ forever-agent@0.6.1 β β βββ¬ form-data@2.3.3 β β β βββ asynckit@0.4.0 β β β βββ combined-stream@1.0.7 deduped β β β βββ mime-types@2.1.24 deduped β β βββ¬ har-validator@5.1.3 β β β βββ¬ ajv@6.10.0 β β β β βββ fast-deep-equal@2.0.1 β β β β βββ fast-json-stable-stringify@2.0.0 β β β β βββ json-schema-traverse@0.4.1 β β β β βββ¬ uri-js@4.2.2 β β β β βββ punycode@2.1.1 β β β βββ har-schema@2.0.0 β β βββ¬ http-signature@1.2.0 β β β βββ assert-plus@1.0.0 β β β βββ¬ jsprim@1.4.1 β β β β βββ assert-plus@1.0.0 deduped β β β β βββ extsprintf@1.3.0 β β β β βββ json-schema@0.2.3 β β β β βββ¬ verror@1.10.0 β β β β βββ assert-plus@1.0.0 deduped β β β β βββ core-util-is@1.0.2 deduped β β β β βββ extsprintf@1.3.0 deduped β β β βββ¬ sshpk@1.16.1 β β β βββ¬ asn1@0.2.4 β β β β βββ safer-buffer@2.1.2 deduped β β β βββ assert-plus@1.0.0 deduped β β β βββ¬ bcrypt-pbkdf@1.0.2 β β β β βββ tweetnacl@0.14.5 deduped β β β βββ¬ dashdash@1.14.1 β β β β βββ assert-plus@1.0.0 deduped β β β βββ¬ ecc-jsbn@0.1.2 β β β β βββ jsbn@0.1.1 deduped β β β β βββ safer-buffer@2.1.2 deduped β β β βββ¬ getpass@0.1.7 β β β β βββ assert-plus@1.0.0 deduped β β β βββ jsbn@0.1.1 β β β βββ safer-buffer@2.1.2 deduped β β β βββ tweetnacl@0.14.5 β β βββ is-typedarray@1.0.0 β β βββ isstream@0.1.2 β β βββ json-stringify-safe@5.0.1 β β βββ¬ mime-types@2.1.24 β β β βββ mime-db@1.40.0 β β βββ oauth-sign@0.9.0 β β βββ performance-now@2.1.0 β β βββ qs@6.5.2 β β βββ safe-buffer@5.1.2 deduped β β βββ¬ tough-cookie@2.4.3 β β β βββ psl@1.1.31 β β β βββ punycode@1.4.1 β β βββ¬ tunnel-agent@0.6.0 β β β βββ safe-buffer@5.1.2 deduped β β βββ uuid@3.3.2 β βββ¬ rimraf@2.6.3 β β βββ¬ glob@7.1.3 β β βββ fs.realpath@1.0.0 deduped β β βββ inflight@1.0.6 deduped β β βββ inherits@2.0.3 deduped β β βββ¬ minimatch@3.0.4 β β β βββ brace-expansion@1.1.11 deduped β β βββ once@1.4.0 deduped β β βββ path-is-absolute@1.0.1 deduped β βββ semver@5.7.0 β βββ¬ xml2js@0.4.19 β βββ sax@1.2.4 β βββ xmlbuilder@9.0.7
But, i put in my package.json the dependencies: "webdriver-manager": "^12.1.2" And fixed the problem. @cnishina Thanks for your prompt response on this issue.
Eu tive o mesmo problema. Ele Γ© resolvido com a atualização do Protractor de 5.4.1 para 5.4.2.π # 5224 (comentΓ‘rio)
Thanks!!!!
For StackOverflow, I tried to find a post to answer. I ended up creating a question and answering it:
I have a quick explanation about what webdriver-manager update is doing and why it happened. Could we upvote for visibility?
Maybe I don't understand how to define versions? I updated my package.json to include "protractor": "^5.4.2"
, but after removing node_modules and reinstalling I see node_modules/protractor/package.json
has "webdriver-manager": "^12.0.6"
(and the problem of downloading a zip.jar).
Maybe I don't understand how to define versions? I updated my package.json to include
"protractor": "^5.4.2"
, but after removing node_modules and reinstalling I seenode_modules/protractor/package.json
has"webdriver-manager": "^12.0.6"
(and the problem of downloading a zip.jar).
Do you have protractor installed globally as well?
No, I use ./node_modules/protractor/bin/protractor
, and I see that which protractor
turns up nothing.
when you run webdriver-manager version
you get version 12.0.6 as well?
I mean the package.json wasn't changed for protractor 5.4.2, just the webdriver-manager is an updated version
I do not have it installed globally. I remember when I started this project it took me some time to discover it's the webdriver inside protractor that needs to be updated, with ./node_modules/protractor/bin/webdriver-manager update
. When I check that version:
$ ./node_modules/protractor/bin/webdriver-manager version
[16:29:49] I/version - webdriver-manager 12.1.1
So, that seems better right? However,
$ ./node_modules/protractor/bin/webdriver-manager update
[16:31:28] I/file_manager - creating folder /home/man/logicgate/dev/logicgate/platform/client/node_modules/protractor/node_modules/webdriver-manager/selenium
[16:31:28] I/config_source - curl -o/home/man/logicgate/dev/logicgate/platform/client/node_modules/protractor/node_modules/webdriver-manager/selenium/standalone-response.xml https://selenium-release.storage.googleapis.com/
[16:31:28] I/config_source - curl -o/home/man/logicgate/dev/logicgate/platform/client/node_modules/protractor/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/
[16:31:28] I/config_source - curl -o/home/man/logicgate/dev/logicgate/platform/client/node_modules/protractor/node_modules/webdriver-manager/selenium/gecko-response.json https://api.github.com/repos/mozilla/geckodriver/releases
[16:31:29] I/downloader - curl -o/home/man/logicgate/dev/logicgate/platform/client/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.46.zip https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip
[16:31:29] I/downloader - curl -o/home/man/logicgate/dev/logicgate/platform/client/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-4.0.0-alpha-1.zip.jar https://selenium-release.storage.googleapis.com/4.0/selenium-server-standalone-4.0.0-alpha-1.zip
...
i.e., alpha zip!, leading to the corrupt jar error on startup.
So you should be on the latest. The latest version is 12.1.4. Previous versions of 12 won't work because the file it is downloading changed. Please review the above for instructions to upgrade.
I did upgrade. Let me try explaining again, because it's very confusing: there are two different definitions of webdriver-manager in play.
The package.json in my project has "protractor": "^5.4.2"
. I have never explicitly had "webdriver-manager" included. When I have run the command to update, which is what pulls in the selenium package, I have run ./node_modules/protractor/bin/webdriver-manager update
-- interacting with the webdriver build that is inside protractor's bin directory. This is kludgy, and requires doing the update after I've installed node_modules, but it worked, up until the breaking change.
Putting "webdriver-manager": "^12.1.4"
in my package.json has no effect on what version protractor uses. I can follow these steps:
npm install
in my project directorynode_modules/protractor/package.json
to update webdriver-manager to ^12.1.4.npm install
in node_modules/protractor/
./node_modules/protractor/bin/webdriver-manager update
to prove that an updated protractor/bin/webdriver-manager will get the right version. But, I'm not looking forward to working "Now edit the post-install protractor package.json" into our CI pipeline. Is there a different way to force protractor to use the latest webdriver-manager?
Can you update your package.json and add webdriver-manager to your devDependencies? That fixed the issue for me.
In the experiment above, both protractor and webdriver-manager (when added) were in devDependencies.
Have you verified that your version is 12.1.4 when you run ./node_modules/protractor/bin/webdriver-manager update
? There are two ways to do this:
Run node_modules/.bin/webdriver-manager version
Protractor (by default) should download the ^12.0.4 version which means it should get 12.1.4. If you are still getting a .zip.jar file that means you have an old version and you need to upgrade this.
I do not recommend adding it to your devDependencies. This is why:
Let's say if Protractor upgrades to version webdriver-manager@13 and you still have devDependencies set to webdriver-manager@^12. When you call ./node_modules/protractor/bin/webdriver-manager update
, you are not guaranteed that you will run version 12 or 13. When Protractor calls for the files it will hopefully use version 13. If your files were downloaded with 12, then these files will not exist when Protractor requires them.
"protractor": "^5.4.2"
in devDependencies , webdriver-manager nowhere$ rm -rf node_modules
npm install
cat node_modules/protractor/package.json|grep webdr
"webdriver-manager": "bin/webdriver-manager"
"@types/selenium-webdriver": "^3.0.0",
"selenium-webdriver": "3.6.0",
"webdriver-js-extender": "2.1.0",
"webdriver-manager": "^12.0.6"
Protractor (by default) should download the ^12.0.4 version which means it should get 12.1.4.
Makes sense. And yet:
$ ./node_modules/protractor/bin/webdriver-manager version
`[11:19:58] I/version - webdriver-manager 12.1.1
Bewildering.
@mathpunk, is there a package-lock.json
file at play here that may have it locked to 12.1.1?
We have an interesting scenario in our organization as we have our own automation-related npm package (on an internal registry) that abstracts automation from our SPAs and applications. That package uses protractor 5.4.2 and does not use a package-lock.json file as we have seen some issues with how npm has deduped dependencies of dependencies, which messed with some of our paths. Anyhow, installing a version of our automation package that has protractor as its dependencies in SPAs and applications that use package-lock.json files still results in webdriver-manager 12.1.1 being used. npm i
would install that as a first-class citizen, which we don't want because 12.1.4 and 12.1.1 would still be present. npm update --depth 9999 webdriver-manager
does not work as I would expect, which would be updating from 12.1.1 to 12.1.4. Short of manually changing package-lock.json in every consuming application of our automation package or regenerating the file fresh, which we don't want because it updates a lot of packages we want to keep where they are to prevent regression test work, I'm not sure what to do.
@cnishina, thanks for all the work you do on Protractor. Would you support a PR of a branch that is branched off 5.4.2, which would only update webdriver-manager to 12.1.4?
@simonua You cracked it! Removed package-lock.json, removed node_modules, installed, got webdriver-manager 12.1.4. I don't understand why versions are defined in two different places in this ecosystem, but hey, problem solved~
Glad that did it. Out of curiosity, if you were to revert your changes and run npm i webdriver-manager@12.1.4
with that explicit version you want instead, I suspect you would be in good shape. The benefit you'd have is that your other versions remain untouched, which limits regression exposure.
Same issue here
Just download right file from selenium site https://selenium-release.storage.googleapis.com/index.html?path=4.0/ I took jar file and changed name from .jar to .zip.jar worked ok
When i start the webdriver-manager i take this error, i did not change anything in my project that justified such an error, and I have been using it for more than a year, every day.
Error: Invalid or corrupt jarfile ./node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-4.0.0-alpha-1.zip.jar
8.12
5.4.2
Chrome
Ubuntu 16.04
require('babel-core/register');
const myReporter = require('./Report/MyReporter'); const Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter'); const failFast = require('jasmine-fail-fast');
module.exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', framework: 'jasmine2', allScriptsTimeout: 600000, capabilities: { browserName: 'chrome', chromeOptions: { args: ['--test-type', 'no-sandbox'], }, }, onPrepare: () => { browser.manage().window().setSize(1200, 1024); jasmine.getEnv().addReporter(failFast.init()); jasmine.getEnv().addReporter(myReporter); jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({ takeScreenshots: true, takeScreenshotsOnlyOnFailures: true, fixedScreenshotName: false, fileNameDateSuffix: true, cleanDestination: false, savePath: './Report/testReports/' })); } };