Setting up Protractor with Microsoft Edge
Asked Answered
C

7

7

I use CucumberJs and Gulp to run my e2e tests; However, I need to run them against Microsoft Edge. When I do gulp protractor, it successfully opens up both Chrome and Firefox, since neither of them require any drivers like IEDriver.exe or EdgeDriver.exe.

Could anyone point me to an article or show the steps below if it's simple on how to set up Protractor with Microsoft Edge?

I'm trying to achieve parallelism by executing my tests on multiple browsers; this is what my config looks like:

 exports.config = {
  framework: 'cucumber',
  shardTestFiles: true,
  maxInstances: 2,
  multiCapabilities: [
    {
       'browserName': 'MicrosoftEdge',
       'platform': 'windows',
      }
    },
    {
      'browserName': 'firefox',
      loggingPrefs: {
        driver: 'DEBUG',
        server: 'INFO',
        browser: 'ALL'
      }
    }],
    //more configs here
}

I achieved the config right above, to run protractor e2e tests in parallel, using this article: http://blog.yodersolutions.com/run-protractor-tests-in-parallel/

Also one for IE driver would be just as helpful if you don't know how to set up Edge.

UPDATES:

From this link: https://msdn.microsoft.com/en-us/library/mt188085(v=vs.85).aspx; under the

Enabling WebDriver with Microsoft Edge:

Download a WebDriver language binding of your choice. Currently C# and Java Selenium language bindings are supported.

I'm not using Java or C#, I am only using Javascript (Protractor); does that mean that the language binding for Javascript currenlty does NOT work for Edge browser?

In other words, we currently cannot automate the Edge browser using Protractor (Javascript)?

Any help much appreciated and I'll update this post if I find anything pertaining to setting up Protractor with Edge, been looking around the web for hours now.

Campos answered 1/2, 2016 at 20:50 Comment(2)
Has anyone had luck actually getting tests to run successfully in Edge? We've been struggling with this issue for a long time now. We can get our test scripts to start executing on Edge, but we can't even get it to navigate to any webpage to see if it's actually doing this thing.Tabbie
is it resovled?Caseation
K
1

After some struggle, I got Protractor to work on Microsoft Edge on my Windows 10 system.

Note: I'm using the Jasmine2 framework instead of Cucumber, but I believe the steps below should work for Cucumber as well. I'll try with Cucumber later and update here.

Here are the steps:

  1. Get the Microsoft EdgeHTML version number in use in your system. In my case it is 15.15063. Take a note of the release number here. In this case it is 15063.

    (Q.: How to get the Microsoft EdgeHTML version number?
    A.: Edge browser > ... > Settings > About this app)

  2. download the correct Release of MicrosoftWebDriver.exe from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

    In my case I downloaded Release 15063. If you get the wrong release, then you are likely to run into an error like this error:

    "This version of MicrosoftWebDriver.exe is not compatible with the installed version of Windows 10."

  3. place the MicrosoftWebDriver.exe in the folder where the other drivers are like:

    C:\Users\yourname\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\
    
  4. Adjust your conf.js file. Essentially, this is what conf.js should have:

    seleniumAddress: 'http://localhost:4444/wd/hub',
    capabilities: // or multiCapabilities:
    {
        'browserName': "MicrosoftEdge"
    }
    
  5. start the webdriver-manager like this:

    C:\your\path>webdriver-manager start --edge C:\Users\yourname\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe
    
  6. You are all set to run your Protractor tests on the Edge browser.

Good Luck!

Kinata answered 7/12, 2017 at 7:39 Comment(0)
I
1
  1. In windows to download the MicrosoftEdge Webdriver for the HTML version >= 18 then follow the below steps

Open Command Prompt, issue the following command and wait until operation gets completed

DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
  1. Open the File Explorer and navigate to C:\Windows\WinSxS and search for MicrosoftWebDriver and it will display two results, copy the webdriver from the amd64_microsoft-webdriver-server-components10.0.18362.1_none and paste it in

/c/Users/Administrator/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium

(Note: Using git bash, it's easy to copy the Webdriver)

  1. In the config file of Edge browser, make the following changes
seleniumArgs:['-Dwebdriver.edge.driver=C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\MicrosoftWebDriver.exe'],

capabilities: {

    'browserName': 'MicrosoftEdge',
    'maxInstances': 1,
    'platformName': 'windows',
    'nativeEvents': false,
     shardTestFiles: true,
  },
  1. Open the command prompt, and navigate to project repo and issue the following command to start the edge session
webdriver-manager start --edge "C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe"
Ihram answered 31/1, 2020 at 0:35 Comment(0)
K
1

I'm using Angular 9 with Edge 89 within linux The following config worked for me

exports.config = {
  directConnect: true,
  chromeDriver: '/path/to/ms-edge/webdriver'
  capabilities: {
     browserName: 'chrome',
     chromeOptions: {
          binary: '/usr/bin/microsoft-edge'
     }
  },
},

Official WebDriver can be found here Since Edge uses Chromium engine, we can reuse all chrome configs and just replace WebDriver and binary path.

Khania answered 10/12, 2020 at 17:16 Comment(0)
H
0

Looks like the Protractor folks are now working on adding Edge support for Protractor. Take a look at the recently opened issue on GitHub.

Hereat answered 20/3, 2016 at 22:11 Comment(0)
R
0

Download the correct release of EdgeHTML webdriver ( https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ ), then settup the conf.js as:

seleniumArgs: ['-Dwebdriver.edge.driver=C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe'],

Capabilities: {
      'browserName': 'MicrosoftEdge',
      'maxInstances': 1,
      'platformName': 'windows',
      'nativeEvents': false,
    }
Rexford answered 31/7, 2019 at 14:16 Comment(0)
I
0

Now Microsoft Edge is supported on Mac Operating System. So to setup in Mac follow below steps

  1. Download the MicrosoftEdge WebDriver from the following link according to version of the edge browser configured in Mac https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

  2. Unzip the folder and copy the Unix executable file to following path /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver

  3. In the config file add SeleniumArgs attribute and capabilities

seleniumArgs : ['-Dwebdriver.edge.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver'],

capabilities: {

browserName: 'MicrosoftEdge',
platformName: 'Mac OS X',
browserVersion: '79.0.309.65',
maxInstances: 1,
shardTestFiles: true,
elementScrollBehavior: 1,
nativeEvents: false

},

  1. In order to start the web driver with Edge Session, use below command..

java -jar -Dwebdriver.edge.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver /Users//Desktop/Project/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar -port 4444

Ihram answered 31/1, 2020 at 0:31 Comment(0)
E
0

Edge won't work with directconnect: true. Please refer below example.

directConnect: false,
 multiCapabilities: [
    {​​​​​
      browserName: 'chrome',
      chromeOptions: {​​​​​
        args: ['--disable-popup-blocking'],
      }​​​​​
        }​​​​​,
{​​​​​
      browserName: 'firefox'
        }​​​​​,
{​​​​​
      browserName: 'MicrosoftEdge'
        }​​​​​
  ],
jvmArgs: [
    '-Dwebdriver.chrome.driver=./src/driver/chromedriver_87.0.4280.20.exe',
    `-Dwebdriver.edge.driver=${edgeDriver}`,
    '-Dwebdriver.gecko.driver=./src/driver/geckodriver-v0.28.0.exe'
  ],

Use below code outside config if using mac

const edgeDriver =
  process.platform === 'darwin'
    ? './src/driver/edgedriver_mac64_87.0.664.47/msedgedriver'
    : './src/driver/msedgedriver.exe';
Enjoyable answered 16/12, 2020 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.