@@ -2,16 +2,24 @@ import { Builder, Capabilities, logging } from "selenium-webdriver";
2
2
import Chrome from "selenium-webdriver/chrome.js" ;
3
3
import Edge from "selenium-webdriver/edge.js" ;
4
4
import Firefox from "selenium-webdriver/firefox.js" ;
5
+ import IE from "selenium-webdriver/ie.js" ;
5
6
import { browserSupportsHeadless } from "../lib/getBrowserString.js" ;
6
7
7
8
// Set script timeout to 10min
8
9
const DRIVER_SCRIPT_TIMEOUT = 1000 * 60 * 10 ;
9
10
10
11
export default async function createDriver ( { browserName, headless, url, verbose } ) {
11
12
const capabilities = Capabilities [ browserName ] ( ) ;
12
- const prefs = new logging . Preferences ( ) ;
13
- prefs . setLevel ( logging . Type . BROWSER , logging . Level . ALL ) ;
14
- capabilities . setLoggingPrefs ( prefs ) ;
13
+
14
+ // Support: IE 11+
15
+ // When those are set for IE, the process crashes with an error:
16
+ // "Unable to match capability set 0: goog:loggingPrefs is an unknown
17
+ // extension capability for IE".
18
+ if ( browserName !== "ie" ) {
19
+ const prefs = new logging . Preferences ( ) ;
20
+ prefs . setLevel ( logging . Type . BROWSER , logging . Level . ALL ) ;
21
+ capabilities . setLoggingPrefs ( prefs ) ;
22
+ }
15
23
16
24
let driver = new Builder ( ) . withCapabilities ( capabilities ) ;
17
25
@@ -49,6 +57,10 @@ export default async function createDriver( { browserName, headless, url, verbos
49
57
edgeOptions . setEdgeChromiumBinaryPath ( process . env . EDGE_BIN ) ;
50
58
}
51
59
60
+ const ieOptions = new IE . Options ( ) ;
61
+ ieOptions . setEdgeChromium ( true ) ;
62
+ ieOptions . setEdgePath ( "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" ) ;
63
+
52
64
if ( headless ) {
53
65
chromeOptions . addArguments ( "--headless=new" ) ;
54
66
firefoxOptions . addArguments ( "--headless" ) ;
@@ -65,6 +77,7 @@ export default async function createDriver( { browserName, headless, url, verbos
65
77
. setChromeOptions ( chromeOptions )
66
78
. setFirefoxOptions ( firefoxOptions )
67
79
. setEdgeOptions ( edgeOptions )
80
+ . setIeOptions ( ieOptions )
68
81
. build ( ) ;
69
82
70
83
if ( verbose ) {
0 commit comments