Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work-around to use Protractor@5.4.2 with Chrome 74+ #5225

Open
luker2 opened this issue Apr 25, 2019 · 55 comments
Open

Work-around to use Protractor@5.4.2 with Chrome 74+ #5225

luker2 opened this issue Apr 25, 2019 · 55 comments

Comments

@luker2
Copy link

luker2 commented Apr 25, 2019

@cnishina Does a work-around exist? Or maybe the possibility of a minor protractor 5 release with latest webdriver fixes/updates?

Reason: It's a huge effort to migrate large protractor projects to version 6.0.0. When chrome auto-updates, you are SOL.

Explanation of problem
Protractor Error

@cnishina
Copy link
Member

There is a fix that is currently tied to webdriver-manager 13.

Good news is that when these changes were happening, I was working on fixing webdriver-manager. You could use Protractor 5.4.2 with webdriver-manager 13. angular/webdriver-manager#372 however I'm not sure how this works with direct connect and local if there are more than one version of webdriver-manager in the node modules directory.

Could we release webdriver-manager 13 with Protractor 5? Possibly but it might be considered as a breaking change since I removed mobile support for webdriver-manager in version 13.

@cnishina
Copy link
Member

Setting discussion tag for Protractor 5 + webdriver-manager 13 release.

@luker2
Copy link
Author

luker2 commented Apr 25, 2019

I'm actually surprised this hasn't stirred up more conversation. I could be wrong, but I'd think other companies on 5.4.2 would be hit by this and also feel the urgency to find a work-around instead of upgrade to 6.0.0.

Can anyone guess the effort needed to create another 5.x.x release?

@cnishina Before your reply I tried hacking around to get the latest webdriver-manager to work with 5.4.2 with no luck. I simply:

  1. npm installed 13
  2. ran webdriver-manager update to download chromedriver 74
  3. copied the selenium folder
    • from node_modules\webdriver-manager\selenium
    • to node_modules\protractor\node_modules\webdriver-manager\selenium

@cnishina
Copy link
Member

cnishina commented Apr 25, 2019

Yup. I was looking at the master branch when looking at the driver providers and not 5.4.2. So there's more work to be done to get 13 to work. Let me go update my PR. I might have to create a beta release for webdriver-manager to experiment with this.

@cnishina
Copy link
Member

Okay angular/webdriver-manager#372 is my workaround for 13 with Protractor 5.4.2 (with tests!).

@luker2
Copy link
Author

luker2 commented Apr 26, 2019

Well I'm at a loss now. All the sudden today I no longer receive yesterday's error, and tests run fine on chrome 74 & chromedriver 2.46

So before, tests were running fine on 73, I purposely updated to 74, then received the above error. So I just assumed it was related, and that anyone who upgraded chrome to 74 would no longer be able to run tests unless they spun up a selenium grid hub/node locally.

According to docs, Chromedriver 2.46 doesn't support chrome 74, but it at least allows me to run tests now? Any idea what else could've changed? Or if that error was even related?

Chrome 74.0.3729.108
Protractor 5.4.2
webdriver-manager 12.1.2
chromedriver_2.46

@luker2
Copy link
Author

luker2 commented Apr 26, 2019

Nevermind, I just saw your SO post and, looking at our previous build logs, it looks like webdriver:manager update was downloading

selenium-server-standalone-4.0.0-alpha-1.zip.jar
instead of
selenium-server-standalone-3.141.59.jar

@cnishina
Copy link
Member

So now this is an actual issue. Chrome 74 came out and Protractor 5.4.2 uses webdriver-manager 12.x.x. This only downloads 2.xx chromedrivers. This is a problem and we'll have a hot fix out for this soon.

@cnishina
Copy link
Member

Related angular/webdriver-manager#376

@cnishina
Copy link
Member

cnishina commented Apr 29, 2019

So here's the fix for webdriver-manager 12 which will work with Protractor 5.4.2: angular/webdriver-manager#377

@cnishina
Copy link
Member

So this has now been resolved with the release of webdriver-manager@12.1.3.

How to get it?

  • do a fresh install of your node modules directory (remove node_modules folder and do a npm install)
  • do a forced install npm install -f

@cnishina
Copy link
Member

@Kurt29
Copy link

Kurt29 commented Apr 30, 2019

I have the problem that Protractor still installs driver 2.46 and when I try to install webdriver-manager on my own and add it to my dependencies, the installed chromedriver cannot be found by Protractor

"C:\Program` Files\nodejs\node.exe" C:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\bin\protractor "C:\Users\Kurt\WebStorm 2019.1.1\plugins\JavaScriptLanguage\helpers\protractor-intellij\lib\protractor-intellij-config.js" --intellijOriginalConfigFile=C:\Users\Kurt\WebstormProjects\hcp\e2e\protractor.conf.js --disableChecks --specs C:\Users\Kurt\WebstormProjects\hcp\e2e\src\settings\homepage.e2e-spec.ts "--grep=^core "
[02:18:10] I/launcher - Running 1 instances of WebDriver
[02:18:10] I/direct - Using ChromeDriver directly...
[02:18:10] E/direct - Error code: 135
[02:18:10] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[02:18:10] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
    at Direct.getNewDriver (C:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\built\driverProviders\direct.js:63:31)
    at Runner.createBrowser (C:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\built\runner.js:195:43)
    at C:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\built\runner.js:339:29
    at _fulfilled (C:\Users\Kurt\WebstormProjects\hcp\node_modules\q\q.js:834:54)
    at C:\Users\Kurt\WebstormProjects\hcp\node_modules\q\q.js:863:30
    at Promise.promise.promiseDispatch (C:\Users\Kurt\WebstormProjects\hcp\node_modules\q\q.js:796:13)
    at C:\Users\Kurt\WebstormProjects\hcp\node_modules\q\q.js:556:49
    at runSingle (C:\Users\Kurt\WebstormProjects\hcp\node_modules\q\q.js:137:13)
    at flush (C:\Users\Kurt\WebstormProjects\hcp\node_modules\q\q.js:125:13)
    at processTicksAndRejections (internal/process/task_queues.js:81:9)
[02:18:10] E/launcher - Process exited with error code 135

Process finished with exit code 135

And here is the config file

const {SpecReporter} = require('jasmine-spec-reporter');

exports.config = {
  SELENIUM_PROMISE_MANAGER: false,
  allScriptsTimeout: 11000,
  specs: [
    './src/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    random: true,
    showColors: true,
    defaultTimeoutInterval: 30000
  },
  random: false,
  onPrepare: async () => {
    require('ts-node').register({
      project: require('path').join(__dirname, './tsconfig.e2e.json')
    });
    jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
    await browser.driver.manage().window().maximize();
  }
};

When I run webdriver-manager update

webdriver-manager: using local installed version 12.1.3
[02:33:40] I/update - chromedriver: file exists C:\Users\Kurt\WebstormProjects\hcp\node_modules\webdriver-manager\selenium\chromedriver_75.0.3770.8.zip
[02:33:40] I/update - chromedriver: unzipping chromedriver_75.0.3770.8.zip
[02:33:40] I/update - chromedriver: chromedriver_75.0.3770.8.exe up to date
[02:33:41] I/update - selenium standalone: file exists C:\Users\Kurt\WebstormProjects\hcp\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.141.59.jar
[02:33:41] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
[02:33:41] I/update - geckodriver: file exists C:\Users\Kurt\WebstormProjects\hcp\node_modules\webdriver-manager\selenium\geckodriver-v0.24.0.zip
[02:33:41] I/update - geckodriver: unzipping geckodriver-v0.24.0.zip
[02:33:41] I/update - geckodriver: geckodriver-v0.24.0.exe up to date


@Kurt29
Copy link

Kurt29 commented Apr 30, 2019

When I remove webdriver-manager from package.json, delete node_modules and run npm i , npm i-f and webdriver-manager update I get

C:\Users\Kurt\WebstormProjects\hcp>webdriver-manager update
[02:38:17] I/file_manager - creating folder C:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium
[02:38:17] I/config_source - curl -oC:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium\standalone-response.xml https://selenium-release.storage.googleapis.com/
[02:38:17] I/config_source - curl -oC:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium\chrome-response.xml https://chromedriver.storage.googleapis.com/
[02:38:17] I/config_source - curl -oC:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium\gecko-response.json https://api.github.com/repos/mozilla/geckodriver/releases
[02:38:17] I/downloader - curl -oC:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium/chromedriver_2.46.zip https://chromedriver.storage.googleapis.com/2.46/chromedriver_win32.zip
[02:38:18] I/downloader - curl -oC:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium/selenium-server-standalone-3.141.59.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
[02:38:18] I/update - chromedriver: unzipping chromedriver_2.46.zip
[02:38:19] I/downloader - curl -oC:\Users\Kurt\WebstormProjects\hcp\node_modules\protractor\node_modules\webdriver-manager\selenium/geckodriver-v0.24.0.zip https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win64.zip
[02:38:20] I/update - geckodriver: unzipping geckodriver-v0.24.0.zip

C:\Users\Kurt\WebstormProjects\hcp>

@cnishina cnishina added P0 and removed status: fixed labels Apr 30, 2019
@cnishina
Copy link
Member

@Kurt29 Weird, you could check the version with node_modules/protractor/node_modules/webdriver-manager/package.json. Are you using global installs?

@cnishina
Copy link
Member

Proposed fixes for downloading specific versions, starting specific versions, status, and preventing 75 from being downloaded.

angular/webdriver-manager#376

@cnishina
Copy link
Member

cnishina commented Apr 30, 2019

I just released 12.1.4 with fix: angular/webdriver-manager#380. This should fix the issues we are seeing with chromedriver 75 and chrome 74 mismatches. Also you should be able to download --versions.chrome 74.0.3729.6 with 12.1.4. This was broken in 12.1.3.

@luker2 Would you like to verify this with me and try out 12.1.4?

@cnishina cnishina added status: fixed and removed P0 labels Apr 30, 2019
@cnishina
Copy link
Member

Okay this has been verified in angular/webdriver-manager#376

@luker2
Copy link
Author

luker2 commented Apr 30, 2019

@cnishina Works on my end.

I specified both 74 and 75 using the --versions.chrome flag and it downloaded the respective drivers. Without the flag it downloaded 74.0.3729.6

Thanks!

@shihuawang
Copy link

Since #5230 is closed, I move comments here:

Because the new version of webdriver-manager@12.1.4 doesn't work (it worked only on May 3, Friday ), I had to try old version, but it doesn't work either.

Chrome 73 worked before May 3, Friday, but no longer work after that. We can't run our test now. We need a solution. Please advice. Thanks in advance.

@shihuawang
Copy link

Clarification: The old version I installed before works fine. But when I create docker, now, with either the current version or old version does not work. So looks like something in some new version is broken.

@shihuawang
Copy link

I have narrowed down the issue. The failure is encountered when the Angular code define a button as:
<button type="submit" class="btn btn-info pull-right" ui-sref="xxx.xxx.xxx">Create New Element</button>
and the Protractor test script is:
browser.driver.findElements(by.xpath('//*[contains(text(), "' + arguments[0] + '")]'));
where arguments[0] = "Create New Element"

@raymonsaadalla
Copy link

Currently i have the webdriver manager version 12.1.4, and chromedriver 74.0.3729.6 so everything should work, but my tests are failing when run on chrome browser 74.0.3729.131; however, it works perfectly fine if I run it on previous 73 version. any suggestion?
Thanks

@shihuawang
Copy link

It doesn't seem to related to the application Web UI code and test script, and my work-around failed again. It looks like that the new version cannot handle benign exceptions or non-blocking error returns. So I don't really have a work around unless completely change the application code so that it doesn't return error or throw exceptions.

@shihuawang
Copy link

Only the system installed when the 73 was released works. But if you install 73 to new server it doesn't work either.

@shihuawang
Copy link

Is there a way I can get any version (new install) work?

@shihuawang
Copy link

Something happened Friday, it was working Friday.

@Priyankajoshipj
Copy link

Hi @cnishina ,

We have the similar problem as @shihuawang and @raymonsaadalla . Our company has a whole Code base of Automated scripts that we run on Protractor, and now that Chrome automatically updated to version 74, the test cases are not getting executed.

We have the following versions of applications:

  • Chrome is 74.0.3729.131,
  • Protractor is 5.4.2,
  • webdriver-manager is 12.1.4,
  • node is v8.12.0,
  • chromedriver is 74.0.3729.6.

We also did a fresh install of webdriver-manager and Protractor (the same versions as above).
Running Protractor scripts got the same result, the Chrome browser appears but then hangs forever.

Unfortunately, downgrading Chrome to version 73 is not an option for us. Is there a workaround to get past this issue?

@ghost
Copy link

ghost commented May 10, 2019

I am in the same company with @Priyankajoshipj. (All my applications are the same versions as hers listed above.) The attached image of our Google Chrome browser is what happens when we try to run a Protractor script. The browser appears then hangs like that forever. The test times out, and the browser still stays like that until we manually close it.

2019-05-10_Hanging Protractor

@cnishina
Copy link
Member

@niyarlatotep I noticed that the npm associated with node version 10.9.0 downloaded webdriver-manager version 12.0.6. When I tried node version 10.15.3, Protractor 5.4.2 includes webdriver-manager 12.1.4. If you still have this issue, I would look into any known issues with npm.

@shihuawang I made an example test. We have pretty similar chrome + chromedriver versions. https://github.com/cnishina/protractor542-chrome74 In this example, I have included the Chrome version and ChromeDriver versions that was downloaded. This works for me at least for a simple example. Again with the issue above, I would double check the node, npm, and webdriver-manager versions. If you are still on Chrome 73, I would refer to version 73.0.3683.68. This can be done with webdriver-manager update --versions.chrome 73.0.3683.68. If you are still on webdriver-manager 12.0.x, it would download chromedriver 2.46 (webdriver-manager update --versions.chrome 2.46) which should work for version 73.

@raymonsaadalla See the above comment on version 73. You can either use Chromedriver 73.0.3683.68 or 2.46.

@XL175816 and @Priyankajoshipj I was able to get this to work with my simple example: https://github.com/cnishina/protractor542-chrome74 When did these tests work previously? Are you using async / await? Is the first website you are directing to not an Angular page?

@vsravuri
Copy link

Please check if Protractor is installed globally. Try removing node_modules folder and try again. I tested with async / await and didn't run into these issues with webdriver-manager 12.1.4. My node version is 10.15.3

@vsravuri
Copy link

You can also try deleting package.lock.json and do npn install again

@ViieeS
Copy link

ViieeS commented May 10, 2019

Also try npm dedupe command. It fixes the bug with webdriver-manager version, if you install it manually.

@ghost
Copy link

ghost commented May 10, 2019

We tried a couple times @vsravuri's suggestion to remove the node_modules folder and reinstall Protractor and webdriver-manager. We also tried deleting package.lock.json and doing "npm install" again.

@cnishina Our tests worked until Monday (5/6) afternoon. They worked all day until Google Chrome automatically updated to version 74; then they all failed, including the ones we had just successfully run minutes before. None of our scripts have async/await. And indeed, the first website we direct to is an Angular page.

@vsravuri
Copy link

Are you using Node 10.15.3? What's the error you see when you run the test? What's the output of webdriver-manager update?

@shihuawang
Copy link

Hi cnishina,
The version 74 + webdriver-manager 12.1.4 + ChromeDriver 74 + nodejs 6.x + Protractor 5.4.2 does not work for us.

@shihuawang
Copy link

This happened several time to us when chrome stable version upgraded, and every time it's fixed later. But this time it hasn't been fixed. I previously said it fixed at one time which was my misunderstanding. So it's never fixed for 74.

@shihuawang
Copy link

At one time, I can get it work by install 73, but now it doesn't work.

The 73 that I previously installed works well, but not work with new installation.

@shihuawang
Copy link

And the cause for the failure is not the exception. It might has to do with timeout of a process, might be something else.

@shihuawang
Copy link

Hi vsravuri, Protractor is installed globally, and most of other cases worked. And before upgrade to 74 it still worked. also my previous installation with 73 still works, but we need to install on new docker for official nightly test. Our project has all been delayed due to this issue.

@shihuawang
Copy link

Hi vsravuri, my error is failed to create a new record which experience timeout with one of step, but it still should be created. and it used to worked until chrome 74. At one time, the 73 didn't work, but later it was fixed. Can you fix 74 in the same way?

@shihuawang
Copy link

Before 74, we can always reverse to older version to get it to work. But no luck this time.

@shihuawang
Copy link

I found that clearing browser cache (manually) may resolve my application's timeout issue, but when I add it to protractor it doesn't seem clear the cache. Can you advice me how to clear cache in protractor. The one I found on web doesn't work for me.

@vsravuri
Copy link

You need to check if there is any issue with ChromeDriver 74 and your automation script. To clear browser cache, you need to choose if you want to delete cookies, local storage or session storage.

Try this
browser.executeScript('window.sessionStorage.clear();');
browser.executeScript('window.localStorage.clear();');
browser.manage().deleteCookie("test_cookie");

@shihuawang
Copy link

Hi vsravuri,
I later got my clear cache worked, some how it has to be in a function as the below link suggested:
https://stackoverflow.com/questions/45218022/how-to-clear-a-browser-cache-in-protractor?rq=1

So this is a work around to my particular issue. But I do hope someone can fix it to handle this situation as how chrome browser do, behave the same way as manual test. This has been a problem in recent several chrome releases and all finally got fixed, except 74.

@ghost
Copy link

ghost commented May 14, 2019

@Priyankajoshipj and I have the following versions of applications:

  • Chrome is 74.0.3729.131,
  • Protractor is 5.4.2,
  • webdriver-manager is 12.1.4,
  • node is v10.15.3,
  • chromedriver is 74.0.3729.6.

Running our scripts still produces the same error as before, with Chrome being blank. (To reiterate myself from above, the browser appears but is blank, never even able to get to https://localhost where our application is, and hangs like that forever. The test times out, and the browser still stays like that until we manually close it.) Because it hangs, the cmd does not say anything (just a blinking cursor), so we don’t even know what the error is.

Clearing the Chrome cache before running a script does not work for us. It has the same result. And our tests should not clear the cache anyway.

We did find something that could be a lead. We were able to run @cnishina ’s simple test mentioned above and, after experimenting around, found a way to get our tests to work. It requires using async/await; we’d have to add “await” in front of every line… Without async/await, Chrome either sometimes gets to https://localhost then immediately closes and says “Error while waiting for Protractor to sync with the page” or sometimes doesn’t get to localhost at all (the forever hanging blank browser I attached above).

However, changing all the code in our scripts would represent a very significant effort. And as mentioned before, unfortunately downgrading Chrome to version 73 is not an option for us. Hope Chrome version 74 can be fixed.

@cnishina
Copy link
Member

@XL175816 going forward we need to make everything async / await because of the control flow deprecation. If async / await is working, it might be a good idea to start the that engineering effort now to upgrade your tests.

@shihuawang Please open up a new bug and add more information. How does it fail? What were you doing? What's the error message? Do you have a sample set of code? What environment are you running your tests on? Reading through the messages from above, I am not sure where to start or how to help.

@cnishina
Copy link
Member

I'm also going to lock down this conversation since this is resolved. I am leaving it open just in case someone still runs into this issue. If you are running into issues with Protractor that you feel are issues with the framework, feel free to open up a new issue. If you are looking for support help, please ask it here: https://stackoverflow.com/questions/tagged/protractor

@angular angular locked as off-topic and limited conversation to collaborators May 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants