angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Update Protractor to use Latest Chromedriver (Otherwise it can't run against Chrome v65) #4728

Open mthoreso opened 6 years ago

mthoreso commented 6 years ago

Update @IgorSasovets posts the best solution in the thread below:


As you mentioned, chromedriver version which protractor uses for tests executing depends on version in node_modules/protractor. I faced such issue few times and fixed it using

node_modules/protractor/bin/webdriver-manager update command. After that I ran my tests and all worked as expected with latest version of chromedriver.


Feature Request

Fix issue running Protractor in Chrome 65.

Once Chrome updates on your machine to version 65, Protractor will no longer be able to execute tests.

The local solution to this is to go download Chromedriver 2.36 and then point your config files to this - and thus override Protractor's Chromedriver choice (2.33.x). chromeDriver: './location/of/your/chromedriver.exe'

I could not figure out a more elegant way to update the chromedriver being used by Protractor other than manually overriding it in the config file.

I think this possibly tied to the version of webdriver-manager that lives in your /node-modules/protractor/bin. I tried to update that, but I don't think you can or it for some reason doesn't take.

My tests were running fine on Friday 9 March, then a co-worker complained that their tests weren't working. I asked him what Chrome version he had (65), then I checked mine and it auto-updated from 64 to 65, then mine stopped working as well. But manually using the newest Chromedriver does fix my problems.

Thank you!

Bug report

Run any test:

[11:17:32] I/launcher - Running 1 instances of WebDriver
[11:17:32] I/direct - Using ChromeDriver directly...
[11:17:38] E/launcher - Error: WebDriverError: unknown error: call function result missing 'value'
  (Session info: chrome=65.0.3325.146)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.14393 x86_64)
    at Object.checkLegacyResponse (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:505:15)
    at parseHttpResponse (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:440:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: Protractor.get(https://<url.under.test>) - reset url
    at Driver.schedule (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:816:17)
    at ProtractorBrowser.executeScriptWithDescription (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\lib\browser.ts:583:24)
    at driver.controlFlow.execute.then.then.then (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\lib\browser.ts:888:23)
    at ManagedPromise.invokeCallback_ (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1366:14)
    at TaskQueue.execute_ (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2970:14)
    at TaskQueue.executeNext_ (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2953:27)
    at asyncRun (C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2813:27)
    at C:\Users\<user>\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:676:7
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[11:17:38] E/launcher - Process exited with error code 100

Process finished with exit code 100
fpoljak commented 6 years ago

I'm having a same issue. How to specify the chromedriver version if we use webdriver_update_specific method?

fpoljak commented 6 years ago

I managed to set it up to update to 2.36 without having to update it manually:

gulp.task('webdriver-update', function(cb) {
  var options = {};
  options.browsers = ['versions.chrome=2.36'];
  return $.protractor.webdriver_update(options, cb);
});

It does the update:

[13:58:06] I/downloader - chromedriver: downloading version 2.36
[13:58:06] I/downloader - curl -o 
/Users/.../node_modules/protractor/node_modules/webdriver- 
manager/selenium/chromedriver_2.36mac64.zip 
https://chromedriver.storage.googleapis.com/2.36/chromedriver_mac64.zip

However, the error is still happening:

[13:58:10] I/local - Starting selenium standalone server...
[13:58:11] I/launcher - Running 1 instances of WebDriver
[13:58:11] I/local - Selenium standalone server started at http://192.168.0.145:62140/wd/hub
[13:58:15] E/launcher - unknown error: call function result missing 'value'
  (Session info: chrome=65.0.3325.162)
  (Driver info: chromedriver=2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6),platform=Mac OS X 10.13.3 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 823 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Franes-MacBook-Pro.local', ip: '192.168.0.145', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.3', java.version: '9'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6), userDataDir=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/.org.chromium.Chromium.X4VDgK}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=65.0.3325.162, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 79aa09723f7d48e32d8a01ed4e2a9397
fpoljak commented 6 years ago

Actually, looking at the error, it seems to still run chromedriver 2.26, which means it doesn't update properly.

mthoreso commented 6 years ago

@fpoljak You are correct - I also tried to update Protractor's webdriver. It looks like it installs but when Protractor runs it uses the old version (for me it was 2.33, for you it was 2.26).

In your config.js file (or whatever you call it) you can add this line to point it to your Chromedriver of choice: chromeDriver: './chromedriver.exe',

Just make sure you place the .exe file in the correct directory (whatever you are specifying).

IgorSasovets commented 6 years ago

Hi @mthoreso ! As you mentioned, chromedriver version which protractor uses for tests executing depends on version in node_modules/protractor. I faced such issue few times and fixed it using

node_modules/protractor/bin/webdriver-manager update

command. After that I ran my tests and all worked as expected with latest version of chromedriver.

mthoreso commented 6 years ago

Hi @IgorSasovets, that is wild because that's exactly what I would want to happen. But! I tried that too and for some reason it still uses the old version:

Updating Protractor's webdriver-manager:

$ node_modules/protractor/bin/webdriver-manager update
[09:55:50] I/update - selenium standalone: file exists C:\Users\thoresma\work\encirca2-ui\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.11.0.jar
[09:55:50] I/update - selenium standalone: selenium-server-standalone-3.11.0.jar up to date
[09:55:50] I/update - chromedriver: unzipping chromedriver_2.37.zip
[09:55:52] I/update - geckodriver: file exists C:\Users\thoresma\work\encirca2-ui\node_modules\webdriver-manager\selenium\geckodriver-v0.20.0.zip
[09:55:52] I/update - geckodriver: unzipping geckodriver-v0.20.0.zip
[09:55:52] I/update - geckodriver: geckodriver-v0.20.0.exe up to date

Then running the test:

[09:59:02] I/launcher - Running 1 instances of WebDriver
[09:59:02] I/direct - Using ChromeDriver directly...
(node:12824) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[09:59:09] E/launcher - Error: WebDriverError: unknown error: call function result missing 'value'
  (Session info: chrome=65.0.3325.162)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.16299 x86_64)

I run the tests using Webstorm, and it utilizes this file: ~\AppData\Roaming\npm\node_modules\protractor\built\cli.js

I wonder if that file somehow is tied or pointed to some old install? I'll have to try and look into that.

fpoljak commented 6 years ago

Yes, I just found it out myself, thanks :)

mthoreso commented 6 years ago

So for me, I needed to utilize the updated Protractor cli.js file. This file will point to the updated Chromedriver after you do what @IgorSasovets did.

fpoljak commented 6 years ago

I added

chromeDriver: path.join(paths.e2e, '../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.36'),

to protractor.conf.js in the config object and it works now.

IgorSasovets commented 6 years ago

I'm happy that it works for you) In my case I didn't need to delete cli.js file because I specified seleniumAddress in config file and started webdriver-manager from project node_modules folder.

PadmaCx commented 6 years ago

We have tried updating to the latest chrome driver(2.37), but still all the scripts are failing due to the error "Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be eithe because this is a non-angular page or because your test involves client-side navigation, which can interfere with Prot ractor's bootstrapping"

IgorSasovets commented 6 years ago

Hi, @PadmaCx ! Actually, latest version of chromedriver is 2.39. I guess that your issue with "window.angular is undefined" related to other problems. I faced with different issues, similar to this.

aburht commented 6 years ago

Any updates on this issue

naitik-aubergine commented 4 years ago

I added

chromeDriver: path.join(paths.e2e, '../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.36'),

to protractor.conf.js in the config object and it works now.

In my case it worked without path.join

chromeDriver: ('../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.36'),

DanielHabenicht commented 4 years ago

For me, the following worked:

  1. Install webdriver-manager as direct dependency. (npm install webdriver-manager --save-dev)
  2. Delete the package-lock.json and node_modules folder.
  3. Do a fresh npm install.

Afterward protractor tests should pick up the webdriver-manager version (Note the paths):

[12:22:08] I/file_manager - creating folder C:\Develop\Repos\ngx-vcard\node_modules\webdriver-manager\selenium
[12:22:08] I/config_source - curl -oC:\Develop\Repos\ngx-vcard\node_modules\webdriver-manager\selenium\chrome-response.xml https://chromedriver.storage.googleapis.com/
[12:22:08] I/downloader - curl -oC:\Develop\Repos\ngx-vcard\node_modules\webdriver-manager\selenium/chromedriver_79.0.3945.36.zip https://chromedriver.storage.googleapis.com/79.0.3945.16/chromedriver_win32.zip
[12:22:09] I/update - chromedriver: unzipping chromedriver_79.0.3945.36.zip
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
sittingbool commented 4 years ago

why is this project so very very far behind with browser-versions??? 76 almost half a year old now. You only need to use the lastest selenium-webdriver version to support it or is there more to it?