Skip to content

[🐛 Bug]: Cannot read OTP from Chrome extension page (chrome-extension://...) after Chrome v136+ #15993

@kashishsinghyadav

Description

@kashishsinghyadav

Description

After updating Chrome to version 136+, i fails to access an internal Chrome extension page (e.g. chrome-extension://kmcfomidfpdkfieipokbalgegidffkal/pages/welcome/index.html) which is used to retrieve an OTP for authentication.

This setup worked fine in Chrome 135 and below. Now, Selenium is unable to switch focus or read from the extension page, breaking the OTP-based authentication step

After upgrading to Chrome v136 or v137:

Extension is loaded via --load-extension=, but Selenium cannot access chrome-extension:// pages.

getOTPToAutenticatBrowser() fails silently or returns nothing.

Even if downgraded, it work fine but when i update auto- again it breaks the setup.

No changes in code—only browser version change caused this.

Likely a security change or policy enforcement in Chrome v136+ (related to extension isolation or restricting programmatic access to chrome-extension:// pages).

Selenium may not support newer context isolation or needs updated handling.

Request for Help:
Can Selenium still access chrome-extension:// pages in newer Chrome versions (v136 and up)?
Is there a workaround, setting, or browser flag needed now?

Would appreciate any insight or guidance. Thanks in advance

Image

Reproducible Code

Chrome option setup : 
String chromeExtensionPath = extensionPath + "\\Chrome";
System.out.println("Loading Chrome extension from: " + chromeExtensionPath);

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--disable-features=IsolateOrigins,site-per-process");
chromeOptions.addArguments("--disable-site-isolation-trials");
chromeOptions.addArguments("--disable-web-security");
chromeOptions.addArguments("--user-data-dir=C:/Temp/ChromeProfile");
chromeOptions.addArguments("--load-extension=" + chromeExtensionPath);
chromeOptions.addArguments("start-maximized");
chromeOptions.addArguments("--disable-features=DisableLoadExtensionCommandLineSwitch");

WebDriverManager.chromedriver().setup();
WebDriver browserDriver = new ChromeDriver(chromeOptions);


my code : 

public void unlock() throws Exception {
    if (!isWebsiteelementpresent.isWebsiteElementPresent(browserRedirection.getUsernameBy())) {
        GenericMethods.scrollToElementBrowser(browserDriver, browserRedirection.getUsernameBy());
    }

    GenericMethods.switchFocusToInlinemenu(browserDriver, browserRedirection.getUsernameBy(), 3, 1000);

    if (inlineMenuScreen.isInlineMenuLocked()) {
        System.out.println("Unlock inline menu");
        inlineMenuScreen.clickInlineMenuLockScreen();
        Thread.sleep(1000);
        GenericMethods.switchFocusToExtension(driver);

        if (iwindowsLoginScreen.unlockButtonVisible()) {
            iwindowsLoginScreen.unlockEnpass(password);
            commonElementsScreen.waitForLoading();
        }
    }

    setupBrowserConnectionSteps.setupMainHelperWindow();
}

public void setupMainHelperWindow() throws Exception {
    if (!extensionMainScreen.isExtensionAuthenticated()) {
        int attemptCount = 0;
        int maxAttempts = 3;

        while (authenticateBrowser.isAuthenticateBrowserVisible() && attemptCount < maxAttempts) {
            System.out.println("Authentication required - Attempt " + (attemptCount + 1));

            GenericMethods.hitEnter(driver);

            try {
                authenticateBrowser.enterOTPToAutenticatBrowser();
            } catch (Exception e) {
                System.out.println("An error occurred while entering the OTP: " + e.getMessage());
                e.printStackTrace();
            }

            GenericMethods.openExtension(driver);

            attemptCount++;
        }

        if (authenticateBrowser.isAuthenticateBrowserVisible()) {
            System.out.println("Authentication failed after " + maxAttempts + " attempts.");
        } else {
            System.out.println("Extension successfully authenticated!");
        }
    }
}

public void enterOTPToAutenticatBrowser() throws InterruptedException, AWTException {
    otp = getOTPToAutenticatBrowser(); // reads OTP from extension page
    System.out.println(otp);
    GenericMethods.switchFocusToExtension(driver);
    sendKeys(driver, otpFieldBy(), otp);
    hitEsc(driver);
}

Debugging Logs

Selenium: 4.33.0(before version having same problem)

ChromeDriver: 137.0.x

Chrome: 136+ (breaks here) 

Java: 17
os - window

ℹ️ Last known working version: 4.33.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-javaJava BindingsD-chromeI-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage again

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions