0

This work is for a large company that's currently using selenium 3 drivers for chrome, ff, edge, etc. We are just now adding coverage for edge selenium testing and while doing so I have noticed that some of the additional arguments that can be added to chrome can not be to this version of the edge driver. I am pretty new to the selenium side of things so I apologize if any of these questions are unclear.

My issue is related to the solution provided in this question: How to remove the infobar "Microsoft Edge is being controlled by automated test software" in selenium test

At the bottom of the top reply they ended up getting version 4.0.0-alpha-4 of the selenium-edge-driver. I'm assuming by the prefix this would be for Selenium 4 and not what we are currently using? And using version 4 for Edge while keeping old versions for the rest probably would not work.

If this is the case, rather than overhaul everything, are there any options on Selenium 3 for adding flags for the Edge browser like Chrome(ie "--use-file-for-fake-audio-capture=") or is Selenium 4 the only choice? This will be for Edge post version 80 (currently version 87).

Sachin
  • 257
  • 1
  • 3
  • 15

1 Answers1

1

Instead of Normal Edge options, You have to use edge options from https://mvnrepository.com/artifact/com.microsoft.edge/msedge-selenium-tools-java

For java use the following code:

       import org.openqa.selenium.chrome.ChromeOptions;
       import com.microsoft.edge.seleniumtools.EdgeOptions;

    private static void setEdgeCapabilities(@NonNull final String browser,@NonNull final DesiredCapabilities capabilities) {
    ChromeOptions options=new ChromeOptions();
    EdgeOptions option=new EdgeOptions().merge(options);
    option.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.ACCEPT);
    option.setAcceptInsecureCerts(true);
    option.addArguments("--no-sandbox");
    option.addArguments("--disable-dev-shm-usage");
    option.addArguments(Arrays.asList("--start-maximized","--use-fake-ui-for-media-stream","--use-fake-device-for-media-stream","--auto-select-desktop-capture-source=Entire screen", "--ignore-certificate-errors"));
    option.merge(capabilities);
    capabilities.setCapability(ChromeOptions.CAPABILITY,option);
Arun
  • 11
  • 1