MicrosoftEdge / EdgeWebDriver

Feedback and discussions about WebDriver for Microsoft Edge
MIT License
58 stars 8 forks source link

[🐛 Bug]: Something wrong when i switch browser tabs with Edge in IE-mode on windows 10. #123

Open zhuyuemings opened 1 year ago

zhuyuemings commented 1 year ago

What happened?

I use selenium-java 4.14.1 and 32 bit Windows IE Driver: IEDriverServer_Win32_4.14.0.zip

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.14.1</version>
</dependency>

I created 2 Tabs with Edge in IE-mode: Tab1, Tab2

when i opened Tab2, and tried to switch to Tab1

driver.get("https://www.baidu.com");
String windowId = driver.getWindowHandle();
driver.switchTo().newWindow(WindowType.TAB);
driver.get("https://lizhi.shop");
driver.switchTo().window(windowId);
String title = driver.getTitle();
i got the title from Tab1, but the browser is still displays Tab2.

and i can not find any wrong in driver log.

How can we reproduce the issue?

this problem 100% occurrence on windows 10 64 bit (22H2), IE 11, any Edge Version(I tried 102-118), java 11, source code :

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WindowType;
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 java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class IESwitchTabTest {

    public static void main(String[] args) {
        String driverLocation = "C:\\work\\driver\\ie\\IEDriverServer.exe";
        String driverLogPath = "C:\\work\\test-out\\driver.txt";
        InternetExplorerOptions options = new InternetExplorerOptions();
        options.attachToEdgeChrome();
        options.introduceFlakinessByIgnoringSecurityDomains();
        System.setProperty("webdriver.ie.driver", driverLocation);
        InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
                .withLogLevel(InternetExplorerDriverLogLevel.DEBUG).build();
        try {
            service.sendOutputTo(new FileOutputStream(driverLogPath, true));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return;
        }
        WebDriver driver = new InternetExplorerDriver(service, options);
        driver.get("https://www.baidu.com");
        String windowId = driver.getWindowHandle();
        driver.switchTo().newWindow(WindowType.TAB);
        driver.get("https://lizhi.shop");
        driver.switchTo().window(windowId);
        String title = driver.getTitle();
        System.out.println(title);
    }

}
zhuyuemings commented 1 year ago

trace log here: driver.txt