selenium: [🐛 Bug]: PageLoad timeouts after using navigate() with IEDriver

What happened?

Hi,

I’m getting an issue with Edge with Internet Explorer mode. After navigating() to a page, Selenium is timing out on PageLoad.

Page is loaded correctly if set in Options with withInitialBrowserUrl. I have configured protected mode to OFF for all zones via the registry.

If withInitialBrowserUrl is set and then navigate() is used and PageLoad=NONE - it works fine.

I also tried this with driver 4.8.1, it also times out. I’m facing the same issue with Robot Framework - actions work only on the page that was set as initial, otherwise it times out.

How can we reproduce the issue?

import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerDriverLogLevel;
import org.openqa.selenium.ie.InternetExplorerDriverService;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Sleeper;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.io.File;
import java.time.Duration;

public class DriverTest {
    public WebDriver driver;
    public final String navigateUrl = "https://www.selenium.dev/documentation/overview/";


    @BeforeTest(alwaysRun = true)
    public void beforeTest() {

        // use jdk-http-client instead of AsyncHttpClient, see: https://www.selenium.dev/blog/2022/using-java11-httpclient/
        System.setProperty("webdriver.http.factory", "jdk-http-client");

        // download driver with WebDriverManager
        WebDriverManager.iedriver().setup();

        // create session with WebDriver with recommended options by Titus: https://titusfortner.com/2022/09/28/edge-ie-mode.html
        InternetExplorerOptions options = new InternetExplorerOptions();
        options.ignoreZoomSettings();
        // when initial URL is set, Selenium can work with the page
        options.withInitialBrowserUrl("https://selenium.dev");
        // test this with another pageLoad strategy - works with NONE
        options.setPageLoadStrategy(PageLoadStrategy.NORMAL);

        // create service to get Selenium log and set log level
        InternetExplorerDriverService service = new InternetExplorerDriverService.Builder().withLogLevel(InternetExplorerDriverLogLevel.TRACE).withLogOutput(System.out).build();
        // test this with local 32 bit driver - doesn't help
        // InternetExplorerDriverService service = new InternetExplorerDriverService.Builder().withLogLevel(InternetExplorerDriverLogLevel.TRACE).withLogOutput(System.out).usingDriverExecutable(new File("C:\\Users\\ferdano\\Downloads\\IEDriverServer_Win32_4.10.0\\IEDriverServer.exe")).build();


        // instantiate driver with Options and Service
        driver = new InternetExplorerDriver(service, options);

        // maximize window
        driver.manage().window().maximize();
    }

    @AfterTest(alwaysRun = true)
    public void afterTest() {

        // quit driver
        driver.quit();
    }

    @Test
    public void ieTestFail() throws InterruptedException {
        WebElement homeH1elem= new WebDriverWait(driver, Duration.ofSeconds(10)).until(driver -> driver.findElement(By.tagName("h1")));
        String homeH1text = homeH1elem.getText();
        Assert.assertEquals(homeH1text, "Selenium automates browsers. That's it!");

        // when navigating to different URL than withInitialBrowserUrl, driver hangs
        driver.navigate().to(navigateUrl);

        System.out.println(">>>Navigation sucessfull");
        Thread.sleep(3000);

        WebElement overviewH1elem= new WebDriverWait(driver, Duration.ofSeconds(10)).until(driver -> driver.findElement(By.tagName("h1")));
        String overviewH1text = overviewH1elem.getText();
        Assert.assertEquals(overviewH1text, "Selenium Overview", "Failed because Selenium hangs after navigation to different URL.");
    }

    @Test
    public void ieTestPass() {
        // when navigating to different URL than withInitialBrowserUrl, driver hangs
        // driver.navigate().to(navigateUrl);

        WebElement homeH1elem= new WebDriverWait(driver, Duration.ofSeconds(10)).until(driver -> driver.findElement(By.tagName("h1")));
        String homeH1text = homeH1elem.getText();
        Assert.assertEquals(homeH1text, "Selenium automates browsers. That's it!");
    }

}

Relevant log output

[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Reading https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/selenium to seek IEDriverServer
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.ie.driver as C:\Users\ferdano\.cache\selenium\IEDriverServer\win64\4.10.0\IEDriverServer.exe
čvc 28, 2023 1:48:32 ODP. org.openqa.selenium.remote.service.DriverService$Builder getLogOutput
INFO: Driver logs no longer sent to console by default; https://www.selenium.dev/documentation/webdriver/drivers/service/#setting-log-output

org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Command: [47d17b43-f2e6-4aea-afe1-5e367a9f4b76, get {url=https://www.selenium.dev/documentation/overview/}]
Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.edgechromium: false, ie.edgepath: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: false, ignoreZoomSetting: true, initialBrowserUrl: https://selenium.dev, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 47d17b43-f2e6-4aea-afe1-5e367a9f4b76

	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:394)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:188)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)
	at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:295)
	at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:984)
	at DriverTest.ieTestFail(DriverTest.java:70)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:969)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.testng.TestRunner.privateRun(TestRunner.java:829)
	at org.testng.TestRunner.run(TestRunner.java:602)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:437)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391)
	at org.testng.SuiteRunner.run(SuiteRunner.java:330)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
	at org.testng.TestNG.runSuites(TestNG.java:1099)
	at org.testng.TestNG.run(TestNG.java:1067)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)
Caused by: java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:377)
	... 34 more


org.openqa.selenium.UnsupportedCommandException: Error 405: Method Not Allowed
DELETE method not allowed
Command duration or timeout: 2.93 seconds
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Command: [47d17b43-f2e6-4aea-afe1-5e367a9f4b76, quit {}]
Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.edgechromium: false, ie.edgepath: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: false, ignoreZoomSetting: true, initialBrowserUrl: https://selenium.dev, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 47d17b43-f2e6-4aea-afe1-5e367a9f4b76

	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:220)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:169)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:570)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:590)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:594)
	at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:446)
	at DriverTest.afterTest(DriverTest.java:60)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
	at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:361)
	at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:296)
	at org.testng.TestRunner.invokeTestConfigurations(TestRunner.java:644)
	at org.testng.TestRunner.afterRun(TestRunner.java:914)
	at org.testng.TestRunner.run(TestRunner.java:605)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:437)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391)
	at org.testng.SuiteRunner.run(SuiteRunner.java:330)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
	at org.testng.TestNG.runSuites(TestNG.java:1099)
	at org.testng.TestNG.run(TestNG.java:1067)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)

Operating System

Windows 11 Enterprise - 21H2

Selenium version

Java 4.10.0

What are the browser(s) and version(s) where you see this issue?

Edge 115.0.1901.188

What are the browser driver(s) and version(s) where you see this issue?

IEDriverServer 4.10.0

Are you using Selenium Grid?

no

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Thank you so much for sharing this! I’ll make a note of it for the next person.

So, when you said this is still related to protected mode, I got an idea to check the registry for Enhanced protected mode Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Main

on my company laptop, under this path I’ve found only this key Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Main\EnterpriseMode with string Enable so I renamed it to xxEnable (or you can delete it, as advised here: https://learn.microsoft.com/en-us/internet-explorer/ie11-deploy-guide/turn-off-enterprise-mode) and then it started working. 🥳

on my personal laptop also with Windows 11, there is no folder “Internet Explorer” at all.

Looks like Enterprise mode has to be off.