angular / protractor

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

Protractor 5.4.2 lack of support for new chromedriver versions like 76.0.3809.68 #5289

Open lukaslewandowski-pearson opened 5 years ago

lukaslewandowski-pearson commented 5 years ago

Hi,

Bug report Protractor 5.4.2 can't work with new Chrome versions like 76.0.3809.87

Feature Request Add support for new chromedriver versions naming convention to Protractor 5.4.2 due to issues with Protractor 6

(My tests are executing in parallel mode with directConnet: true and I am using async/await.)

harsha509 commented 5 years ago

Hi @lukaslewandowski-pearson ,

There is webdriver-manager version 12.1.6 which supports chrome 76. You can install through npm i webdriver-manager@12.1.6. It may resolve the issue.

The new webdriver-manager will be released along with latest protractor version later

Thanks!

lukaslewandowski-pearson commented 5 years ago

Hi @Harsha509 , Thx for replay but it looks like Protractor is using his own webdriver-manager in node_modules/protractor/node_modules/webdriver-manager and adding webdriver-manager to project dependencies or installing it globally is not changing the behavior of the Protractor.

I will add that my tests are executing in parallel mode with directConnet: true and I am using async/await.

Morcatko commented 5 years ago

I was able to fix it by adding this to my test project package.json

"postinstall": "cd ./node_modules/protractor && npm i webdriver-manager@latest",

It reinstalls webdriver-manager used internally by protractor. You can add && node bin/webdriver-manager update but some other postinstall script runs that for me automatically

harsha509 commented 5 years ago

Hi @lukaslewandowski-pearson

directConnect: true uses drivers available in node_modules in current directory, enabling below in config

@morcatko thanks for the workaround.

hope this both solution helps

directConnect: false, seleniumAddress:"http://localhost:4444/wd/hub"

and starting webdriver-manager start globally uses the selenium server started globally.

lukaslewandowski-pearson commented 5 years ago

WOW @Morcatko I own you a beer :) it works like a charm :) Thank you

My final version: "postinstall": "cd ./node_modules/protractor && npm i webdriver-manager@latest && cd ../.. && ./node_modules/.bin/webdriver-manager update",

Dolly2315 commented 5 years ago

@Morcatko Thanks , it worked for me as well :)

krithi0503 commented 5 years ago

Hi All,

I tried all of the above suggestions with no luck yet. I have tried the below -

1. directConnect: true

And then in my package.json added

"postinstall": "cd ./node_modules/gulp-protractor && npm i webdriver-manager@12.1.6 && cd ../../ && ./node_modules/.bin/webdriver-manager update --gecko=false"

I have tried this with and without adding explicit dependency

"webdriver-manager": "12.1.6"

The below is the error message I see -

E/direct - Error code: 135
[12:06:06] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[12:06:06] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
  1. directConnect: false

Same Dependency and Post Install script as above. I am able to see the browser launch with the web url but nothing else happens.

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'MC02S8298G8WM', ip: '192.168.130.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_181'
Driver info: driver.version: unknown
UnsupportedOperationError: touchSingleTap
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'MC02S8298G8WM', ip: '192.168.130.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_181'
Driver info: driver.version: unknown

The Chrome is currently on version 76.0.3809.100 and the latest chromedriver downloaded seems to be chromedriver_76.0.3809.12 for webdriver@12.1.6. I specifically tried mentioning a different higher version as well in update command

webdriver-manager update --versions.chrome=76.0.3809.68

The below was the error -

[12:24:58] E/launcher - Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'MC02S8298G8WM', ip: '192.168.130.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_181'
Driver info: driver.version: unknown

I am pretty much flabbergasted and out of options. Is there anything else we could try? P.S : Protractor upgrade is not feasible since we can't upgrade our node version.

Dolly2315 commented 5 years ago

Please try running webdriver-manager update with step 1 @krithi0503

krithi0503 commented 5 years ago

Please try running webdriver-manager update with step 1 @krithi0503

Unfortunately still throws the error - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.

harsha509 commented 5 years ago

Hi @krithi0503 ,

can you please provide your capabilities using to launch the chrome.

Thanks

krithi0503 commented 5 years ago

@Harsha509 : These are the code snippets corresponding to the capabilities in config -

directConnect: true,
browserName: 'chrome',
shardTestFiles: true,
maxInstances: 4,
chromeOptions: {
     mobileEmulation: {
           deviceName: 'iPhone 6'
     } 
}

Note : I have tried without parallel execution as well.

harsha509 commented 5 years ago

Hi @krithi0503 ,

I have 2 updates for you.

  1. As you're using directConnect: true ,

navigate to project root/node_modules/.bin webdriver-manager clean and project root/node_modules/.bin> npm i webdriver-manager@12.1.6 and project root/node_modules/.bin>webdriver-manager update

It should download chrome 76_drivers

if you see any error -> 'Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.'

you can do

project_root\node_modules\protractor\node_modules\webdriver-manager\bin> node webdriver-manager update

  1. If you're using chorme 75 + versions, 'chromeOptions' doesn't work. they have changed their capability to 'goog:chromeOptions' which current selenium doesn't support. you have to update to selenium 4 else downgrade to chrome 74

Thanks!

krithi0503 commented 5 years ago

Hi @krithi0503 ,

I have 2 updates for you.

  1. As you're using directConnect: true ,

navigate to project root/node_modules/.bin webdriver-manager clean and project root/node_modules/.bin> npm i webdriver-manager@12.1.6 and project root/node_modules/.bin>webdriver-manager update

It should download chrome 76_drivers

if you see any error -> 'Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.'

you can do

project_root\node_modules\protractor\node_modules\webdriver-manager\bin> node webdriver-manager update

  1. If you're using chorme 75 + versions, 'chromeOptions' doesn't work. they have changed their capability to 'goog:chromeOptions' which current selenium doesn't support. you have to update to selenium 4 else downgrade to chrome 74

Thanks!

Thanks for this. With minor tweaks this solution worked. Modified to 'goog:chromrOptions' and added this in postInstall script -

"postinstall": "cd ./node_modules/webdriver-manager && webdriver-manager clean && cd ../.. && npm i webdriver-manager@12.1.6 --no-save && webdriver-manager update --gecko=false && cd ./node_modules/gulp-protractor && npm i webdriver-manager@12.1.6 --no-save && webdriver-manager update --gecko=false",

tfaron commented 5 years ago

Using directConnect=false, we start a seleniumSession and pass the seleniumSessionId however as of 12.1.5 passing seleniumSessionId fails with the following error so not sure how we can connect using Chrome 76.

...\projects\client-ng\node_modules.bin\protractor C:\svt-web-client\projects\client-ng\protractor.e2e.atf.conf.js --seleniumSessionId=f2720b90bf7763c8ba87ecf155b33d31 --grep "C1980075_OMNI_69706_6"' [08:59:57] I/launcher - Running 1 instances of WebDriver [08:59:57] I/attachSession - Using the selenium server at http://127.0.0.1:4444/wd/hub [08:59:57] I/attachSession - Using session id - f2720b90bf7763c8ba87ecf155b33d31 [08:59:57] E/runner - Unable to start a WebDriver session. [08:59:57] E/launcher - Error: UnsupportedOperationError: unknown command: Cannot call non W3C standard command while in W3C mode Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'DESKTOP-KP0NDTR', ip: '16.100.206.160', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221' Driver info: driver.version: unknown at Object.checkLegacyResponse (C:\svt-web-client\projects\client-ng\node_modules\selenium-webdriver\lib\error.js:546:15) at parseHttpResponse (C:\svt-web-client\projects\client-ng\node_modules\selenium-webdriver\lib\http.js:509:13) at doSend.then.response (C:\svt-web-client\projects\client-ng\node_modules\selenium-webdriver\lib\http.js:441:30) at process._tickCallback (internal/process/next_tick.js:68:7) [08:59:57] E/launcher - Process exited with error code 100

oomkarpandit commented 5 years ago

Try this - it worked for me: Using Direct Connect.

Add this script to package.json: "postinstall": "cd ./node_modules/protractor && npm i webdriver-manager@latest",

then:

npm run postinstall webdriver-manager update npx webdriver-manager update

gmangat commented 5 years ago

I was getting the error before "Chrome version should be between 71 and 75" and now have updated the latest chrome driver and also added the above in package.json but now i started getting some circular reference error. This is the updated chrome driver image The error i keep getting after now is : [Failed: javascript error: circular reference (Session info: chrome=76.0.3809.100) (Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.17763 x86_64)

Any idea/ help will be really appreciated

brunonf15 commented 5 years ago

Same issue here. After the update, this error also appears:

[16148:0814/103221.329:INFO:CONSOLE(170)] "%cElectron Security Warning (Insecure Content-Security-Policy)", source: C:\Users\bruno.figueiredo\Pictures\smc-monitor-software\node_modules\electron\dist\resources\electron.asar\renderer\security-warnings.js (170)
[10:33:17] E/launcher - unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.17763 x86_64)
[10:33:17] E/launcher - WebDriverError: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.17763 x86_64)
    at Object.checkLegacyResponse (C:\Users\bruno.figueiredo\Pictures\smc-monitor-software\node_modules\selenium-webdriver\lib\error.js:546:15)
ghost commented 5 years ago
    "pree2e": "./node_modules/protractor/bin/webdriver-manager update",
    "e2e": "npm run pree2e && ng e2e --webdriver-update=false"
Amy-Lynn commented 5 years ago

The solutions here seem to mostly require the webdriver-manager used by protractor being in a known location, which isn't great if you're providing a framework library to be consumed by others (who may use hoisting in a monorepo).

I don't love it, but would (optionally) specifying the folder of webdriver-manager for protractor to use be an option? Then I can list webdriver-manager as a direct dependency of my project, point it at that, and not need to jump through the hoops of finding where the one protractor is going to use is installed

istudiomobile commented 5 years ago

I have exact same error as @brunonf15 but with Chrome 77 using webdriver-manager 77.0.3865.10, 77.0.3865.40 and 77.0.3865.75 in Angular 7 running tests with VS Code.

smhc commented 4 years ago

I have a related problem running Protractor 5.4.2 with Chrome, IE or any other driver implementing w3c. The 'window/resize' command has been renamed 'window/rect' and webdriver 3.6 does not have the compatibility layer that webdriver 4+ has.

see: https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/lib/webdriver.js#L1462

and https://www.w3.org/TR/webdriver1/#set-window-rect

I have had to work around the problem with the following hack:


browser.driver.getExecutor().defineCommand('setWindowRect_W3C', 'POST', '/session/:sessionId/window/rect');

    public static resize(width: number, height: number) {
        // Determine if driver is w3c compliant or not
        if ((<any>browser.driver).getExecutor().w3c) {
            // We need to manually construct a command because webdriver 3.6.0
            // does not construct a w3c compliant 'rect' command. This results
            // in errors such as: unknown command: session/xxx/window/size
            // for browsers that have deprecated the JSON wire protocol API
            let resizeCommand = new Command('setWindowRect_W3C');
            resizeCommand.setParameter('x', 0);
            resizeCommand.setParameter('y', 0);
            resizeCommand.setParameter('height', height);
            resizeCommand.setParameter('width', width);

            return browser.driver.schedule(resizeCommand, 'W3C-shim window rect: ' + height + ',' + width);
        } else {
            // If not w3c driver, use old JSON wire protocol API
            return browser.driver.manage().window().setSize(width, height);
        }
    }
DanielHabenicht commented 4 years ago

fyi there is a similar issue here: #4728 This might be a duplicate.