angular / protractor

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

directConnect not working with FF 52+ and Protractor 5.1.1 (unable to parse new session response) #4253

Open heathkit opened 7 years ago

heathkit commented 7 years ago

Protractor 5.1.1 is using version 3.0.1 of the Selenium JS bindings. When using directConnect: true Protractor will control geckodriver directly. Unfortunately, this version of the JS bindings is no longer compatible with the latest geckodriver (See https://github.com/mozilla/geckodriver/issues/555 https://github.com/mozilla/geckodriver/issues/529 and https://github.com/SeleniumHQ/selenium/issues/3607).

The solution is to use selenium standalone when testing with Firefox. The latest version of the selenium standalone server is compatible with Protractor's selenium JS bindings and with geckodriver. You can update and launch the standalone server with

webdriver-manager update
webdriver-manager start

and set seleniumAddress: http://localhost:4444. For an example using selenium standalone, see protractor cookbook. Note Protractor 5.1.1 requires Selenium 3 or greater and Firefox 52 or greater.

In the meantime, directConnect: true will not work with Firefox until the external issues are fixed and Protractor's selenium-webdriver version is updated.

heathkit commented 7 years ago

There are various issues talking about Firefox that are somewhat out of date or confusing, so I thought I'd collect the latest info in a new issue.

Protractor 5.1.1 requires the latest Selenium 3 and only works with Firefox 52 or higher (you might be able to get Firefox < 47 working with marionette: false, I'm not sure). You need to use a selenium standalone server, directConnect: true will not work due to the above external issues. This is the case for geckodriver 0.15. Firefox 52, and Protractor 5.1.1, but may change with future versions.

Geckodriver is maturing and getting closer to the spec, so I'm betting directConnect will work again in future Protractor releases with updated selenium-webdriver JS bindings.

NickTomlin commented 7 years ago

Thanks for collecting this; super helpful when dealing with issues that may have different symptoms but all reflect problems with FF

mleu commented 7 years ago

Thanks also for collecting this. As far as I (naively) see there seem to be no relevant external bugs open anymore, so the "only" thing missing would Protractor updating it's Selenium JS Bindings to match the requirements of geckodriver...?

heathkit commented 7 years ago

That's correct. And Protractor does currently work with selenium-webdriver 3.3.0. However, the tricky part is bringing all the typings up to date. Unfortunately, we don't really have the time to maintain the selenium-webdriver typings, but assuming they're accurate and up to date the next steps would be:

The hardest part is making sure the selenium-webdriver types are accurate with selenium-webdriver 3.4.0. But if some enterprising individual wanted to take that on (see how to contribute to DefinitelyTyped), then we could easily update Protractor and resolve this issue.

benitogf commented 7 years ago

making sure the selenium-webdriver types are accurate with selenium-webdriver 3.4.0,

how can we test this requirement?

heathkit commented 7 years ago

If you update to the latest selenium and typings, tsc compiles without errors, and npm test passes then it should be good.

seanmay commented 7 years ago

@heathkit None of those things are accurate. I mean, your assessment is totally accurate, but the types are way off.

The tsc errors on compile (on a fresh npm install) are actually masked by a crash on Jasmine (easy enough to fix, but fixing it involves bumping a few more types).

Once Jasmine and cohorts are updated, there are promise and Control flow errors.

These errors are already there, in part; they just aren’t noticed because of the Jasmine crash.

Once fixed, you will start seeing type issues. Then, once you update Selenium, there are some big breaking changes in the API which are not reflected in the @types. Notably, there are methods which were deprecated and pulled from Promises, which affect every type that returns a promise.

This is part of the purgatory I found myself in, as regards the FF issue.

On May 14, 2017 7:38 PM, "heathkit" notifications@github.com wrote:

If you update to the latest selenium and typings, tsc compiles without errors, and npm test passes then it should be good.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/angular/protractor/issues/4253#issuecomment-301347807, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfDgTEGvP4_S0x0yvQGnaVi8sEMiZavks5r55CCgaJpZM4NMxrW .

NickTomlin commented 7 years ago

I've run into this as well; the typings are a bit crazy. @seanmay I'd be happy to try and pair/work through these with you because i'd love to have a clean(er) typing story moving forward.

heathkit commented 7 years ago

Thanks for laying out the issues in detail, @seanmay. As you can see, it's a lot of work, and unfortunately some of it is just updating types for Jasmine and selenium-webdriver. With ControlFlow deprecation coming (https://github.com/SeleniumHQ/selenium/issues/2969), there's lots of changes to WebDriver Promises, which are used extensively throughout Protractor.

This is more work than the current maintainer has time for, so contributions are very welcome!

allspat commented 7 years ago

[19:55:07] I/status - selenium standalone version available: 3.4.0 [last] [19:55:07] I/status - chromedriver version available: 2.29 [last] [19:55:07] I/status - geckodriver version available: v0.16.1 [last]

But 'unable to parse' is still reproducible. Any ETA for this?

krisztiankocsis commented 7 years ago

I have the same issue, with the same version as in the last comment. Do anybody know where is the problem?

warnero commented 7 years ago

Been beating my head against this for the past day and a half. Hopefully this gets fixed soon.

mattcollier commented 7 years ago

Tracking this: https://github.com/digitalbazaar/bedrock-protractor/issues/16

Supamiu commented 6 years ago

Currently trying to make protractor work with the latest geckodriver, the issue is reproducible.

I have the issue with both true and false for the directConnect option.

wswebcreation commented 6 years ago

@Supamiu

That is doesn't work with directConnect is a known issue. The path is not correctly set in Protractor. This has been fixed on Github by @cnishina , but not in a new release.

I tried to run it locally without directConnect and Firefox 55 and GeckoDriver 0.19.0 + Selenium 3.5.3 and 3.4.0 and they all work. Can you provide more info about your config / script and so on to verify where the problem is?

Supamiu commented 6 years ago

Sure, here is the configuration I'm using to start protractor with firefox:

exports.config = {
    framework: 'jasmine',
    directConnect: false,
    allScriptsTimeout: 360000,
    specs: ['tests/**/*.spec.js'],
    // I'm using multiCapabilities because at the end I'll have chrome and IE in this array
    multiCapabilities: [
        {
            browserName: 'firefox'
        }
    ],
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 360000
    },
    localSeleniumStandaloneOpts: {
        jvmArgs: ["-Dwebdriver.gecko.driver=node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.19.0.exe"]
    }
};

The error occurs something like 10min after I started the tests, protractor opens an empty browser, making no navigation. Here are the logs of this error:

I/launcher - Running 1 instances of WebDriver
I/local - Starting selenium standalone server...
I/local - Selenium standalone server started at http://10.10.44.118:61237/wd/hub
E/launcher - Unable to parse new session response:
E/launcher - WebDriverError: Unable to parse new session response:
    at doSend.then.response (<project dir>\protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:445:19)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
    at Function.createSession (<project dir>\protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
    at Function.createSession (<project dir>\protractor\node_modules\protractor\node_modules\selenium-webdriver\firefox\index.js:640:55)
    at createDriver (<project dir>\protractor\node_modules\protractor\node_modules\selenium-webdriver\index.js:167:33)
    at Builder.build (<project dir>\protractor\node_modules\protractor\node_modules\selenium-webdriver\index.js:629:16)
    at Local.getNewDriver (<project dir>\protractor\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
    at Runner.createBrowser (<project dir>\protractor\node_modules\protractor\built\runner.js:195:43)
    at q.then.then (<project dir>\protractor\node_modules\protractor\built\runner.js:339:29)
    at _fulfilled (<project dir>\protractor\node_modules\protractor\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (<project dir>\protractor\node_modules\protractor\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (<project dir>\protractor\node_modules\protractor\node_modules\q\q.js:796:13)
E/launcher - Process exited with error code 199

Process finished with exit code 199
wswebcreation commented 6 years ago

Downgrading back to version 0.18.0 doesn't fix the issue, just as a workaround?

Supamiu commented 6 years ago

I don't know how to downgrade the geckodriverto 0.18.0 using webdriver-manager, the main issue being that I have a postinstallentry in my package.json that calls webdriver-manager update in order to have the latest version of each driver I need.

That being said, I tried by downloading the 0.18.0 release on geckodriver repository, then manually paste it in my webdriver-manager/selenium folder and configure protractor to use it, I have the same issue, I double checked, it was the 0.18.0 loaded for this one, not the 0.19.0. Same issue for both of them.

wswebcreation commented 6 years ago

@Supamiu

You can do webdriver-manager update --versions.gecko=v0.18.0 in your npm package to downgrade it to 0.18.0

Still it's very strange. Can you please create a new issue for this and provide us with an example project where this can be debugged. Without the project it will be hard to debug. Also not having more issues with this, like you described, makes me wonder if it's a bug or a local configuration.

By the way, with my local configuration (Mac OSX 10.12.6 + FF 55 + GeckoDriver 0.19.0) I don't get exceptions on my current Angular (4) project and also not on Sauce (that's behind a tunnel so I can't share it)

marklagendijk commented 6 years ago

This is fixed in the current version of Protractor: 5.2.0.

shaungrady commented 6 years ago

Confirmed, it's now working for me in 5.2.0. Thank you! 🙇

JochenDiekenbrock commented 6 years ago

I updated to Protractor 5.2.0, directConnect is not working for me.

webdriver-manager is on version 12.0.6, Firefox is version 56.0.2 64 bit on Windows 7. In the capabilities, I have browserName: 'firefox', 'moz:firefoxOptions': { 'binary': 'D:/dev/Firefox 56.0.2/firefox.exe', 'args': ['-profile', 'd:/temp/protractor-firefox-profile'], 'log': {'level': 'trace'} }

When I start Protractor, Firefox opens fine (and it's the expected version) and the robot in the address bar shows that Firefix is remote controlled. But than it just waits and nothing happens. No error messages are displayed in the console, just I/launcher - Running 1 instances of WebDriver I/direct - Using FirefoxDriver directly...

With selenium, it's working fine.

Any ideas?

rafalf commented 6 years ago

I can confirm that this is working with:

C:\Users\rafal>protractor --version
Version 5.2.1
C:\Users\rafal>webdriver-manager update
[13:23:15] I/file_manager - creating folder C:\Users\rafal\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium
[13:23:17] I/update - chromedriver: unzipping chromedriver_2.33.zip
[13:23:20] I/update - geckodriver: unzipping geckodriver-v0.19.1.zip

and latest kick ass fast firefox

JochenDiekenbrock commented 6 years ago

Thank you for the reply @rafalf. It's still not working on my work system, probably because something is messed up. It works fine on another system.

husseinkorly commented 6 years ago

Still having an issue running geckodriver with directConnect: true, but I was able to make it work if I change geckoDriverFile in _\protractor\built\driverProviders\direct.js_ to reference directly to the location of geckodriver. it looks like the update-config.json not getting updated with geckoDriverFile !!!

I'm using: Protractor: 5.2.2 firefox: 57.0.2

Splaktar commented 3 years ago

Is this all sorted out and working now? Should this work on macOS Catalina with Protractor v7, Firefox 89, and GeckoDriver 0.29.1?