angular / protractor

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

Protractor browser.getCurrentUrl() stopped working with latest chrome v70.x #5077

Open maulikpatel890 opened 5 years ago

maulikpatel890 commented 5 years ago

Hello,

After chrome browser has upgraded to version v70.x, our existing protractor tests are stopped working. The issue happens with below scenario:

  1. Click on the button in the application which opens another URL in the new tab of chrome.
  2. I am using below to verify if correct URL is opened in the new tab. expect(browser.getCurrentUrl()).toContain("URL abc"); The tests hang on here. In the older version of chrome, the same test is working abosolutely fine.

Please see below supporting details. I could not see any trace log as it hangs. Kindly help us as soon as possible.

'acceptInsecureCerts' => false, 'acceptSslCerts' => false, 'applicationCacheEnabled' => false, 'browserConnectionEnabled' => false, 'browserName' => 'chrome', 'chrome' => { chromedriverVersion: '2.44.609545 (c2f88692e98ce7233d2df7c724465ecacfe74df5)', userDataDir: '/var/folders/tc/lrcs5wtx3hncrdznh3v62v8w0000gn/T/.org.chromium.Chromium.f0eeNy' }, 'cssSelectorsEnabled' => true, 'databaseEnabled' => false, 'goog:chromeOptions' => { debuggerAddress: 'localhost:53836' }, 'handlesAlerts' => true, 'hasTouchScreen' => false, 'javascriptEnabled' => true, 'locationContextEnabled' => true, 'mobileEmulationEnabled' => false, 'nativeEvents' => true, 'networkConnectionEnabled' => false, 'pageLoadStrategy' => 'normal', 'platform' => 'Mac OS X', 'rotatable' => false, 'setWindowRect' => true, 'takesHeapSnapshot' => true, 'takesScreenshot' => true, 'unexpectedAlertBehaviour' => 'ignore', 'version' => '70.0.3538.110', 'webStorageEnabled' => true,

maulikpatel890 commented 5 years ago

Error Logs:

13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16) 13 verbose stack at emitTwo (events.js:125:13) 13 verbose stack at EventEmitter.emit (events.js:213:7) 13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at emitTwo (events.js:125:13) 13 verbose stack at ChildProcess.emit (events.js:213:7) 13 verbose stack at maybeClose (internal/child_process.js:927:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

cnishina commented 5 years ago

Chrome 70 + ChromeDriver 2.44?

Does ChromeDriver 2.44 work with Chrome 70.0? I would look into downloading a newer version of ChromeDriver. Currently webdriver-manager does not download version 70 due to a parsing error but I should have a fix in by maybe next year. I have an alternative that does download ChromeDriver (https://github.com/cnishina/webdriver-manager-replacement). Note that it has limitations (direct connect or a local start of the binaries will not work). Another solution, downgrade Chrome on your test machine.

To manually download ChromeDriver 70.0

use the url: https://chromedriver.storage.googleapis.com/ (Provides the xml snippet below) and the path noted by <Key>

So for mac x64 it would be https://chromedriver.storage.googleapis.com/70.0.3538.16/chromedriver_mac64.zip

<Contents>...</Contents>
<Contents>
<Key>70.0.3538.16/chromedriver_mac64.zip</Key>
<Generation>1537228580401426</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-09-17T23:56:20.401Z</LastModified>
<ETag>"4d01ffac43d8e63a6bb334dbb99010c0"</ETag>
<Size>5935851</Size>
</Contents>
<Contents>
<Key>70.0.3538.16/chromedriver_win32.zip</Key>
<Generation>1537228581777336</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-09-17T23:56:21.776Z</LastModified>
<ETag>"ed2a5a850121af095a61b816319cf42b"</ETag>
<Size>3536229</Size>
</Contents>
<Contents>
<Key>70.0.3538.67/chromedriver_linux64.zip</Key>
<Generation>1539793394140824</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-10-17T16:23:14.140Z</LastModified>
<ETag>"33059ab16448402ed2e6bdd302ed1aa2"</ETag>
<Size>3639590</Size>
</Contents>
<Contents>
<Key>70.0.3538.67/chromedriver_mac64.zip</Key>
<Generation>1539793395562598</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-10-17T16:23:15.562Z</LastModified>
<ETag>"c69c48e41dd22e31d4054506a0696672"</ETag>
<Size>5936605</Size>
</Contents>
<Contents>
<Key>70.0.3538.67/chromedriver_win32.zip</Key>
<Generation>1539793396943249</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-10-17T16:23:16.942Z</LastModified>
<ETag>"5d7c2f0aa152608a100d8483db5417fa"</ETag>
<Size>3537147</Size>
</Contents>
<Contents>
<Key>70.0.3538.97/chromedriver_linux64.zip</Key>
<Generation>1541488743877715</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-11-06T07:19:03.877Z</LastModified>
<ETag>"8f10bcf955a106305de082a34558e738"</ETag>
<Size>3640017</Size>
</Contents>
<Contents>
<Key>70.0.3538.97/chromedriver_mac64.zip</Key>
<Generation>1541488745383885</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-11-06T07:19:05.383Z</LastModified>
<ETag>"1bfa75f3a3482147403eb5e309858cc1"</ETag>
<Size>5939993</Size>
</Contents>
<Contents>
<Key>70.0.3538.97/chromedriver_win32.zip</Key>
<Generation>1541488747021615</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2018-11-06T07:19:07.021Z</LastModified>
<ETag>"054d108aed4f364085a19d1089389f05"</ETag>
<Size>3539215</Size>
</Contents>

I'll leave this issue open because other users might run into this issue until we have a fix out.

devoto13 commented 5 years ago

@cnishina http://chromedriver.chromium.org/downloads claims that 2.44 works with 69-71.

cnishina commented 5 years ago

Well, other than that... I can't tell from the information provided. Could you provide more information than just capabilities?

kennydifiore commented 4 years ago

Experiencing a similar issue where browser.getCurrentUrl() never resolves and causes the tests to timeout. Using macOS, Node v10.20.1, Chrome 81.0.4044.138, and Chrome Driver chromedriver_81.0.4044.138.

Protractor 5.4.4 or protractor 7.0.0 both exhibit this issue.

EDIT: Calling await browser.waitForAngularEnabled(false); seems to fix the issue.