angular / protractor

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

Officially support Microsoft Edge #2377

Closed mgol closed 8 years ago

mgol commented 9 years ago

Microsoft published edgedriver - a driver for the Microsoft Edge browser. Protractor should support it as it supports Internet Explorer.

jpoints commented 9 years ago

Edge kind of works now, however there are some problems. I am not sure if it is that the Microsoft Webdriver is just not fully compatible with Webdriver Specs yet, or there are hiccups in the Protractor implementation with the Microsoft Driver.

Currently I do the following to get the edge server to work with protractor.

Anyways, with respect to Edge, I am running into the following problems.

  1. manage.windows actions are causing the edge browser to crash. browser.driver.manage().window().maximize(); Error : "Unknown command received"
  2. Action sequences are not working with the edge driver. browser.actions().mouseMove(element(by.css("#whyyounoworky"))).perform(); Error : "Unknown command received" (This problem makes Edge unusable for me. Since I have lots of hovering to do)

Note: The IE11 (32Bit) driver does not display these problems, and works correctly.

TARIFABBAS commented 9 years ago

I am also getting some issue in Microsoft Edge, such as multiple driver is not working. when second browser is open it overrides the first one.

public static void main(String args[]) throws InterruptedException, AWTException { OpenBrowser2 op=new OpenBrowser2(); op.openBrowser(); op.openBrowser(); op.openBrowser(); op.openBrowser(); } public void openBrowser() { System.setProperty("webdriver.edge.driver", "C:/Program Files (x86)/Microsoft Web Driver/MicrosoftWebDriver.exe"); driver= new EdgeDriver(); driver.get("www.google.com"); }

Also getting Unknown Command Received when trying to maximize window.

shaokaichris commented 8 years ago

Hi jpoints,

I am trying to use protractor to run my tests on Microsoft Edge, and I followed the steps you mentioned above. However, what I am seeing is that MS edge is open and address bar shows the url (the baseUrl in protractor.conf.js), then it hangs there, the page is not rendered/displayed.

Eventually, I get an error message saying Error while running testForAngular: not implemented.

Anything you can help? Thanks in advance. Kai

evilaliv3 commented 8 years ago

i'm getting the same error of @shaokaichris on the GlobaLaks project.

here you find some debugging info: https://travis-ci.org/globaleaks/GlobaLeaks/jobs/86801624

evilaliv3 commented 8 years ago

@juliemr i think that on this front there are good news. the selenium-webdriver changelog for 2.52.0 mentions explicitly:

Add support for Microsoft's Edge web browser

p.s.: take care that i've notifce that in various project files i've noted that it's still defined the use of selenium-webdriver 2.48.2; maybe is now better to align it all to the 2.52.0? e.g. in the https://github.com/angular/protractor/blob/3d12d894ba1bcc97c51339ee5ce87c26d8e5ceed/package.json

\cc @sjelin

cnishina commented 8 years ago

upgrade to selenium-webdriver @ 2.52.0. #2987

cnishina commented 8 years ago

upgrade config.json to selenium server jar @ 2.52.0. #2998

evilaliv3 commented 8 years ago

@cnishina could you please clarify which is the status for this and if making it work with edge is now simply a matter of configuring it well?

cnishina commented 8 years ago

@evilaliv3 Protractor relies on exec async script and the Microsoft Edge Driver shows the status of this as still in preview. This investigation is tracked on #3016.

cnishina commented 8 years ago

Looks like it might be time to take a look at this again. Microsoft webdriver.

molant commented 8 years ago

@cnishina the list of all the commands and in what version they have been implemented is available here. @instylevii can probably help or give more information if needed.

InstyleVII commented 8 years ago

Hey @cnishina we actually do support execute script/execute script async and have since build 10586 (our fall update). I've been updating all of our documentation pages and they should reflect this now. Note that we support the JSON Wire Protocol endpoint and not the W3C spec endpoint (yet) for both (JSON Wire Protocol is further down the page). You can check out all of our commands supported here: https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/webdriver-commands/

Also for downloads you can get our relevant version here: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

juliemr commented 8 years ago

Hi @InstyleVII thanks for the further info! Our issue is specifically that we need execute async script to work, which is still listed as unsupported under "Webdriver spec support", but supported under "JSON Wire Protocol support". Could you clarify? (EDIT: what I meant to ask is, could you clarify what supporting the JSON protocol but not W3C spec means?)

InstyleVII commented 8 years ago

@juliemr The language bindings via Selenium will be able to use execute async as well. We support the implementation just not the W3C specs endpoint (/session/{session id}/execute/async) on our server. We'll be updating it to add that endpoint in the future. So just to be clear both execute script and execute async script work in our webdriver implementation (and have since our fall update 10586). If you run into issues though feel free to ping me on here or on twitter @instylevii.

cnishina commented 8 years ago

This appears to be working now with release 10586 (version 2.10586). Example here:

https://github.com/cnishina/protractor-examples/tree/master/protractor/edge_spec

Also, added webdriver-manager support for edge: https://github.com/angular/webdriver-manager/pull/56

evilaliv3 commented 8 years ago

@cnishina fixed but will be available starting from 4.0.0 milestonre right?

do you have already an ETA?

thanks!

cnishina commented 8 years ago

@evilaliv3 Yes... 4.0.0 milestone. ETA = soon (maybe the end of the month?). webdriver-manager has support for Edge but you still need to download the binaries.

evilaliv3 commented 8 years ago

@cnishina @juliemr

could you please clarify if the user has still to download the edge webdriver manually and if yes how is the process for using it with protractor?

i think it would be important to improve documentation around this topic.

i've tried with saucelabs but i'm getting this error: Error while waiting for Protractor to sync with the page: "[ng:test] http://errors.angularjs.org/1.5.7/ng/test"

https://s3.amazonaws.com/archive.travis-ci.org/jobs/145769678/log.txt

thanks as usual!

inthegarage commented 8 years ago

@evilaliv3 Yes you must still download the edge driver manually and I have batch file that runs it manually also.

java -jar "C:\Users\<your user>\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-2.53.1.jar" -Dwebdriver.gecko.driver=C:\tools\gecko\geckodriver.exe -Dwebdriver.firefox.bin="C:\Program Files\Nightly\firefox.exe" -Dwebdriver.edge.driver="C:\tools\gecko\MicrosoftWebDriver.exe"

Ensure the driver is version 2, version 1 simply does not work. You can strip the marionette (FF 48+) stuff out if you wish.

Then in your protractor conf file do the following:

        baseUrl: 'http://127.0.0.1:4321/index_protractor.html',
        capabilities: {
            'browserName': 'MicrosoftEdge',
            elementScrollBehavior: 1,
            nativeEvents: false
        }

_You need to refer to the baseURL in your test file:

beforeAll(function() {
    browser.get(browser.baseUrl);_

The above in italics, no longer seems to be needed.

That bit is code clutter and sucky. Can this be improved please?

And you will also need to use the very latest protractor 4.0.0+

evilaliv3 commented 8 years ago

@inthegarage i'm using travis + saucelabs where i expect the selenium/edge webdriver to be updated but the test is still not working: https://s3.amazonaws.com/archive.travis-ci.org/jobs/150395376/log.txt


Failures:
1) globaLeaks setup wizard should allow the user to setup the wizard
  Message: Failed: Error while waiting for Protractor to sync with the page: "[ng:test] http://errors.angularjs.org/1.5.8/ng/test"

The same tests are instead working perfectly on internet explorer 11: https://travis-ci.org/globaleaks/GlobaLeaks

do you know if there is any incompatibility with saucelabs?

inthegarage commented 8 years ago

@evilaliv3 I'm sorry I don't know much about that. My view point is to try and run my tests on MS Edge, and they don't work. I don't use saucelabs as far as I know.

evilaliv3 commented 8 years ago

Okay the issue with saucelabs is that they currently do not offer the recent preview version of Edge.

evilaliv3 commented 8 years ago

p.s.: the link for tracking the edge capabilities is changed: https://developer.microsoft.com/en-us/microsoft-edge/platform/status/

molant commented 8 years ago

@evilaliv3 the old link with details (https://developer.microsoft.com/en-us/microsoft-edge/platform/status/webdriver/details/) should now redirect to the documentation with the supported commands.

joshmgrant commented 8 years ago

I'm trying to get MS Edge to run against some Protractor tests I've written on Win 10 using Protractor 4.0.3 and selenium-server 2.53.1.

I followed the above setup and ran

protractor conf_edge.js

based on this example. Edge opens up but then webdriver immediately crashes and I'm getting the following error:

[15:18:58] I/hosted - Using the selenium server at http://localhost:17556
[15:18:58] I/launcher - Running 1 instances of WebDriver
[15:18:59] E/launcher - null
[15:18:59] E/launcher - WebDriverError: null
    at WebDriverError (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:27:10)
    at Object.checkLegacyResponse (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:639:15)
    at parseHttpResponse (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:538:13)
    at C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:472:11
    at ManagedPromise.invokeCallback_ (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
    at TaskQueue.execute_ (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
    at TaskQueue.executeNext_ (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
    at C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2820:25
    at C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
    at process._tickCallback (node.js:369:9)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
    at Builder.build (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\builder.js:458:24)
    at Hosted.DriverProvider.getNewDriver (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\driverProvider.js:37:33)
    at Runner.createBrowser (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\built\runner.js:187:43)
    at C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\built\runner.js:261:30
    at _fulfilled (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
    at C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49
    at runSingle (C:\Users\joshua.grant\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13)
[15:18:59] E/launcher - Process exited with error code 199
cnishina commented 8 years ago

Did you start webdriver-manager with:

webdriver-manager start --edge?

You will have to install the edge driver yourself and if the path is different than the default path, you'll need to specify that value on the flag.

joshmgrant commented 8 years ago

@cnishina I tried starting up the webdriver-manager as you suggest and get the same result. I also have the Microsoft WebDriver service running on port 17556.

cnishina commented 8 years ago

If you are starting the edge driver yourself, then you should specify the seleniumAddress as http://127.0.0.1:17556. If you do it the way suggested, edge will be started as part of the standalone selenium server.

joshmgrant commented 8 years ago

I've tried both approaches, and neither work.

Using the webdriver-manager start --edge approach yields an ECONNECT error that Protractor can't connect to Edge properly.

Using the Microsoft Web Driver server started directly, I get the same result as above.

However, as a sanity check I tried connecting to Edge using the Python WebDriver bindings and it yields similar errors even with the configuration suggested. So something fishy is going on here. Likely not a protractor-related problem, so thanks for the help to get this far!

molant commented 8 years ago

@joshin4colours maybe you are not using the right version of webdriver for your version of edge. https://developer.microsoft.com/microsoft-edge/tools/webdriver/ has links and info of each version.

joshmgrant commented 8 years ago

@molant wow, thanks for that! Fixed the issue and Edge works now as expected. I totally had the wrong version of the MS Web Driver. Thanks so much!

molant commented 8 years ago

Glad to hear it worked! In the near future we will be checking you are using the right version so this doesn't happen :)

evilaliv3 commented 8 years ago

does some of you know how to make it work with travis + saucelabs?

\cc @christian-bromann @pamepros

christian-bromann commented 8 years ago

@evilaliv3 just set proper capabilities. Works with WebdriverIO flawlessly so it should with Protractor:

var browser = require('webdriverio').remote({
    user: process.env.SAUCE_USERNAME,
    key: process.env.SAUCE_ACCESS_KEY,
    desiredCapabilities: {
        browserName: 'MicrosoftEdge',
        platform: 'Windows 10',
        version: '13.10586'
    }
})

browser
  .init()
  .url('http://webdriver.io')
  .getTitle().then(console.log)
  .end();

Check out the Platform Configurator to get proper capabilities.

evilaliv3 commented 8 years ago

thanks @christian-bromann, i know this.

the issue is that protractor uses a version of edge that is in "preview" status; for this reason all saucelabs users do not have the possibility for now to test the angularjs applications.

i think you should keep this into account in the saucelabs development in order to fill this huge market gap.

evilaliv3 commented 8 years ago

@christian-bromann: here you can find the example of the failure applied to the GlobaLeaks project: https://s3.amazonaws.com/archive.travis-ci.org/jobs/159344349/log.txt

christian-bromann commented 8 years ago

@evilaliv3 I just ran a successful test with this config in protractor 2

// conf.js
exports.config = {
  sauceUser: process.env.SAUCE_USERNAME,
  sauceKey: process.env.SAUCE_ACCESS_KEY,
  specs: ['specs/1_spec.js'],

  multiCapabilities: [{
    browserName: 'MicrosoftEdge',
    platform: 'Windows 10',
    version: '13.10586'
  }]
}

If protractor 4 has issues running edge than it is more likely an issue of protractor 4 not Sauce Labs itself.

evilaliv3 commented 8 years ago

@cnishina @sjelin could you please clarify what you think?

evilaliv3 commented 8 years ago

It seems that Microsoft update the document: https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/webdriver-commands/

now the async script support has been changed from "preview" to "not supported" and they set a priority 2. :(

InstyleVII commented 8 years ago

Hey @evilaliv3 if you scroll down on that page you'll note that we actually do support execute/execute async. We just don't support the W3C endpoint for execute async (we plan to update this in our next release). The actual functionality though is there and Selenium will support it (JSON Wire Protocol is the older, more established dialect while the W3C spec is currently trying to get to Candidate Review). That page is more so for implementers of language bindings that for end devs to use.

evilaliv3 commented 8 years ago

I see. From what stable release? From 14 right?

InstyleVII commented 8 years ago

@evilaliv3 Nope 13 or 10586 has execute async, only 12 was missing it I believe.

POST /session/:sessionId/execute Supported 10240 - 12 POST /session/:sessionId/execute_async Supported 10586 - 13

itLead797 commented 7 years ago

Thumbs up on the support of MicrosoftEdge v13.10586. Haven't yet been able to get v14.14291 or the latest v21.10540 to work.

smajazayeri commented 7 years ago

Can I kindly ask someone to explain me how I can run a test against MS Edge? What I did so far was just downloading Microsoft Edge webdriver from here and replacing chrome with edge in my protractor.conf as follows:

const config = {
    baseUrl: 'https://local.adminportal.com:444/',
    specs: [ './dist/**/*.e2e-spec.js' ],
    framework: 'jasmine',
    directConnect: false,
    capabilities: {
        browserName: 'MicrosoftEdge',
        platform: 'Windows 10',
        version: '13.10586'
    },
    onPrepare: function() {
        browser.ignoreSynchronization = false;
    },
    useAllAngular2AppRoots: true
};

exports.config = config;

Unfortunately, when running my tests, I receive this error: The path to the driver executable must be set by the webdriver.edge.driver system property;

smajazayeri commented 7 years ago

I found out I have to use the webdriver of MS Edge from here. Then, I should reopen my CLI (cmd, git bash, etc.) :-) However, there're 2 questions left: 1) can I save the webdriver exe file somewhere in my project folder instead of my C:/program files/...? 2) how can I ignore ssl certificates as I currently face with certificate error on my local host and I have to manually proceed the app.

inthegarage commented 7 years ago

As far as I know webdriver.exe can be anywhere and is specified in your batch file. The certificate of the web-site should be added via keygen to the certs of the java you are using. Check the documentation here: https://docs.oracle.com/javase/tutorial/security/toolsign/rstep2.html

Java should see that this is trusted cert and proceed with the connection. If it is the browser doing this, then it needs to also do the same thing by importing the saved certificate to windows.

smajazayeri commented 7 years ago

Thanks @inthegarage for your explanation. I came up with the cert error using this solution:

if (title.includes('Certificate error')) {
    driver.get('javascript:document.getElementById(\'invalidcert_continue\').click()');
}

A new issue I'm struggling with is opening edge in an InPrivate window. Any thoughts?

inthegarage commented 7 years ago

@smajazayeri The code is fine, but bear in mind all tests from all projects may have to implement this code. If your project set-up is consistent then it maybe worth while replacing the code with some set-up as suggested. It does depend on your own set-up. However I'd avoid decorating all projects with this.

All I can suggest is checking these posts and see if you can use the options contained in them:

http://stackoverflow.com/questions/33224070/how-to-open-incognito-private-window-with-selenium-wd-for-different-browser-type

smajazayeri commented 7 years ago

Thanks @inthegarage for your advice. However, the link you shared with me doesn't contain any documentation about edge. I also tried to run protractor on IE. The first time it failed with error:

Unexpected error launching Internet Explorer. Unable to use CreateProcess() API. To use CreateProcess() with Internet Explorer 8 or higher, the value of registry setting in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth must be '0'.

When I added the required reg key, the error was gone, but the "inPrivate" mode wasn't really "inPrivate". I mean when I manually tried the IE in inPrivate mode, it used my last session!!???

tyaga001 commented 6 years ago

Unable to launch edge driver with protractor. Raised a question as well here. https://stackoverflow.com/questions/47766363/unable-to-launch-microsoft-edge-with-protractor Could anyone please help here.