I have the following code that launches Edge in IE Compatibility mode:
case EDGE_COMPATIBILITY: {
logMessage(MessType.INFO, "Running Edge under compatibility mode.");
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.introduceFlakinessByIgnoringSecurityDomains();
ieOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
ieOptions.attachToEdgeChrome();
ieOptions.destructivelyEnsureCleanSession();
System.setProperty("webdriver.ie.driver", projectLoc + "\\src\\externaljars\\selenium\\edgedriver\\iedriverserver.exe");
try {
logMessage(MessType.INFO, "About to create 'webdr'");
webdr = new InternetExplorerDriver(ieOptions);
logMessage(MessType.INFO, "Sleeping for 10 seconds.");
Thread.sleep(10000);
logMessage(MessType.INFO, "Done sleeping ...");
webdr.manage().window().maximize();
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
break;
}
This works great when running the automated scripts locally, here is what it looks like:
TITLE Executing Method launchBrowser Time: [1:38:34PM]
INFO TEMP LOG MESSAGE : Data Source: DATABASE Browser: EDGE_COMPATIBILITY URL: null
INFO TEMP LOG MESSAGE : Browser: EDGE_COMPATIBILITY
INFO Running Edge under compatibility mode.
INFO About to create 'webdr'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Started InternetExplorerDriver server (32-bit)
4.7.0.0
Listening on port 23537
Only local connections are allowed
INFO Sleeping for 10 seconds.
INFO Done sleeping ...
but when I try to run the same code from a Jenkins server, I get the following exception error:
14:02:26 [testng] TITLE Executing Method launchBrowser Time: [4:2:26PM]
14:02:26 [testng] INFO TEMP LOG MESSAGE : Data Source: DATABASE Browser: EDGE_COMPATIBILITY URL: null
14:02:26 [testng] INFO TEMP LOG MESSAGE : Browser: EDGE_COMPATIBILITY
14:02:26 [testng] INFO Running Edge under compatibility mode.
14:02:26 [testng] INFO About to create 'webdr'
14:02:27 [testng] Started InternetExplorerDriver server (32-bit)
14:02:27 [testng] 4.7.0.0
14:02:27 [testng] Listening on port xxxxxx
14:02:27 [testng] Only local connections are allowed
14:05:28 [testng] org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
14:05:28 [testng] Host info: host: 'xxxxxxxxxx', ip: 'xx.xx.xx.xx'
14:05:28 [testng] Build info: version: '4.6.0', revision: '79f1c02ae20'
14:05:28 [testng] System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.11'
14:05:28 [testng] Driver info: org.openqa.selenium.ie.InternetExplorerDriver
14:05:28 [testng] Command: [null, newSession {capabilities=[Capabilities {browserName: internet explorer, se:ieOptions: {ie.edgepath: C:\Program Files (x86)\Micr..., ignoreProtectedModeSettings: true}}], desiredCapabilities=Capabilities {browserName: internet explorer, se:ieOptions: {ie.edgepath: C:\Program Files (x86)\Micr..., ignoreProtectedModeSettings: true}}}]
14:05:28 [testng] Capabilities {}
14:05:28 [testng] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:559)
What is even more interesting is that if I log onto the Jenkins server to see what's going on, then I don't get the exception error. It is as though attaching a screen output completes the instantiation process.
Does anyone know whether this is a Jenkins limitation? Or are there any other InternetOptions that I should be using.