|
| 1 | +# Generic WebDriver Setup for Chromium-based Edge |
| 2 | + |
| 3 | +In a [comment from April |
| 4 | +2020](https://github.com/SeleniumHQ/selenium/issues/8237#issuecomment-629851734), |
| 5 | +the Selenium maintainers said that they would not support Chromium-based Edge in |
| 6 | +Selenium 3. They instead suggested waiting for a stable version of Selenium 4. |
| 7 | +However, as of December 2020, there is no release date in sight for Selenium 4, |
| 8 | +Chromium-based Edge is the only version of Edge actively supported by Microsoft |
| 9 | +since August 2020, and [legacy Edge will reach end-of-life status in March 2021.](https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666) |
| 10 | + |
| 11 | +Thankfully, Generic WebDriver Server is generic enough to handle this case. We |
| 12 | +can use it to configure Selenium 3 to respond to Edge and use Microsoft's |
| 13 | +`msedgedriver.exe` as a backend executable. |
| 14 | + |
| 15 | +If you haven't read |
| 16 | +[setup.md](https://github.com/google/generic-webdriver-server/blob/main/setup.md) |
| 17 | +yet, that is where you will find general information on setting up Generic |
| 18 | +WebDriver Server. This document will focus on specific setup instructions for |
| 19 | +Chromium-based Edge. |
| 20 | + |
| 21 | +## Setup |
| 22 | + |
| 23 | +*NOTE: Though our custom backends can be configured to respond to arbitrary |
| 24 | +browser names, `msedgedriver.exe` responds only to the browser name `msedge` as |
| 25 | +far as we can tell. So it is important not to change the browser name in the |
| 26 | +configs below to anything else!* |
| 27 | + |
| 28 | +1. Make sure you have the correct version of `msedgedriver.exe` for your version |
| 29 | +of Edge. See [Microsoft's instructions to check Edge version and download |
| 30 | +the right driver](https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/?tabs=javascript#install-microsoft-edge-chromium). |
| 31 | +You should have Edge version 75 or later. |
| 32 | + |
| 33 | + |
| 34 | +2. Install GenericWebDriverServer: |
| 35 | + |
| 36 | +```sh |
| 37 | +npm install -g generic-webdriver-server |
| 38 | +``` |
| 39 | + |
| 40 | + |
| 41 | +3. Create a node config file like this one as `node_edge.json`: |
| 42 | + |
| 43 | +```json |
| 44 | +{ |
| 45 | + "capabilities": [ |
| 46 | + { |
| 47 | + "browserName": "msedge", |
| 48 | + "seleniumProtocol": "WebDriver", |
| 49 | + "maxInstances": 2 |
| 50 | + } |
| 51 | + ], |
| 52 | + "host": "127.0.0.1", |
| 53 | + "port": 5555, |
| 54 | + "hub": "http://localhost:4444" |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +You **must** set the `browserName` field to `"msedge"` exactly. You may |
| 59 | +customize `maxInstances`, `host`, `port`, and `hub` to your grid setup, and you |
| 60 | +may add additional Selenium node configurations as you see fit. |
| 61 | + |
| 62 | + |
| 63 | +4. Create the following batch file as `start_edge_node.bat`: |
| 64 | + |
| 65 | +```bat |
| 66 | +set NODE_MODULES_PATH="%APPDATA%\npm\node_modules" |
| 67 | +
|
| 68 | +java ^ |
| 69 | + -cp "%NODE_MODULES_PATH%"\generic-webdriver-server\GenericWebDriverProvider.jar;"%NODE_MODULES_PATH%"\generic-webdriver-server\selenium-server-standalone-3.141.59.jar ^ |
| 70 | + org.openqa.grid.selenium.GridLauncherV3 ^ |
| 71 | + -role node ^ |
| 72 | + -nodeConfig node_edge.json |
| 73 | +``` |
| 74 | + |
| 75 | +You may replace the jar file paths with whatever is appropriate for your system, |
| 76 | +but this should be the right path for many installations of NPM on Windows. |
| 77 | + |
| 78 | + |
| 79 | +5. Launch `start_edge_node.bat` to start the Selenium node for Chromium-based |
| 80 | +Edge, or configure Windows to launch it automatically on startup. If you have |
| 81 | +some existing system for starting and managing your Selenium nodes, you may run |
| 82 | +the command lines from `start_edge_node.bat` in your own way. |
0 commit comments