Edge looks weird. Changing the resolution of Edge browser is not possible. (Edgedriver)

Chandra Mouli Kunche 0 Reputation points
2025-03-18T05:36:43.8666667+00:00

I am using webdriverio to run the automated tests in edge browser. Previously when I did this with chrome browser it works fine. But something is different and weird when I try to run tests on ms edge. So whenever I try to run tests the browser look like this
image

The tests are running but few of the steps or even scenarios are failing due to the resolution of this browser. I can't change the window size using edge options. And also it does not have the maximize button on it and it cannot open another tab. And it looks completely different than chrome browser. I think both browsers are Chromium-based, but I don't understand why I don't have control over Edge like I do with Chrome . Need help here!!

{
"webdriverio": "^8.40.0",
}

import * as webDriver from "webdriverio";

export const createBrowser = async (

) => {
    return retry(
        async () => {
            const browser = await webDriver.remote({
                logLevel: "warn",
                path: "/",
                capabilities: {
                    browserName: "MicrosoftEdge",
                    acceptInsecureCerts: true,
                    "ms:edgeOptions": {
                        args: edgeArguments(),
                        excludeSwitches: ["enable-logging"],
                        binary: config.edgeBinary,
                    },
                    "wdio:edgedriverOptions": {
                        binary: config.edgeWebDriverBinary,
                    },
                    pageLoadStrategy: "none",
                },
            });
            return { browser, log: await createLog(browser) };
        },
        "connect to edge browser using WebDriver/Puppeteer",
        10,
    );
};


export const edgeArguments = (

) => {
    const args = [
        "--window-size=1366,728",
        "--enable-features=NetworkService",
        "--enable-automation",
        "--disable-site-isolation-trials",
        "--hide-crash-restore-bubble",
        "--disable-session-crashed-bubble",
    ];

<............SOME CODE HERE.............>
    return args; 
} 

Microsoft Edge | Microsoft Edge development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-03-18T09:13:56.1033333+00:00

    Hi @Chandra Mouli Kunche

    Edge shows this window because you have this policy Browser sign-in settings set to 'Force'. You must sign into a profile to use Edge. To fix the issue, you have two methods:

    Method 1: Change the policy Browser sign-in settings to 'Not Configured'.

    Method 2: If you can't change the policy, you could sign into a profile in Edge first. Then use that profile when automating Edge.

    I'm not familiar with webdriverio. I searched online and it shows that you can add the profile path to Edge arguments to specify a profile to use. For example:

    'user-data-dir=/Users/username/Local/Microsoft/Edge/User Data'
    'profile-directory=Profile 1'
    

    To find the profile path you signed in, you can open edge://version/ in Edge and check the value of Profile path. If it points to 'Default' folder, you only need to set user-data-dir argument. If it points to 'Profile x' folder, you need to set both user-data-dir and profile-directory.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Yu Zhou


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.