LoginSignup
0
0

More than 3 years have passed since last update.

WebdriverIO で Edge (EdgeHTML v18) を動かす方法

Posted at

ターゲットブラウザ

Edgeは2種類ありますが、今回動かしたのはレガシー版のEdgeHTMLです。
新Microsoft Edge登場、レガシー版とChromium版の見分け方は? | マイナビニュース

動いた方法

①MicrosoftWebDriver.exeをインストールします

WebDriver - Microsoft Edge Developerを参考に、コマンドプロンプトを管理者権限で開き、以下のコマンドを実行します。

DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0

インストールが完了すると「C:\Windows\System32\MicrosoftWebDriver.exe」に実行ファイルが作成されます。

②selenium-standaloneの引数にMicrosoftWebDriver.exeを指定します

フルのサンプルコードはこちらです。
https://github.com/proyuki02/webdriverio-edgehtml-example

edge.wdio.conf.ts
import { Config } from "webdriverio";
import { config as defaultConfig } from "./default.wdio.conf";

const drivers = {
  MicrosoftEdge: {
    binary: "C:\\Windows\\System32\\MicrosoftWebDriver.exe",
  },
};

const config: Config = {
  ...defaultConfig,

  capabilities: [
    {
      maxInstances: 1,
      browserName: "MicrosoftEdge",
    },
  ],
  services: [
    [
      "selenium-standalone",
      {
        installArgs: { drivers },
        args: { drivers },
      },
    ],
  ],
};

export { config };

proxyを通す方法

テスト実行前にEdgeを開いてproxyを設定しておけば、それが使用されます。

ちなみに、capabilitiesにproxyを設定しても、WebDriverがサポートしてないのでダメっぽいです。
WebDriver (EdgeHTML) - Microsoft Edge Development | Microsoft Docs

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0