0

I am running selenium scripts on Edge browser. one of the functionality requires to initiate a audio or video call between two windows. In chrome, we can use 'use-fake-ui-for-media-stream' in chrome options. Is there anything similar for Edge. If there isn't, is there a way to accept these alerts at runtime. I have tried -

driver.switchTo().alert().accept(),

but this also doesn't work, and throws error saying no such alert present

Edited

I am using Edge chromium and java selenium and have set properties as below in code. Still permission pop up shows when script runs

      Map<String, Object> prefs = new HashMap<String, Object>();
      prefs.put("profile.default_content_settings.popups", 0);
      prefs.put("download.default_directory",  fileDownloadLocation);
      EdgeOptions options= new EdgeOptions();
      options.setCapability("prefs", prefs);
      options.setCapability("allow-file-access-from-files", true);
      options.setCapability("use-fake-device-for-media-stream", true);
      options.setCapability("use-fake-ui-for-media-stream", true);
      DesiredCapabilities capabilities = DesiredCapabilities.edge;
      capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS,true);
      capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS,true);
      System.setProperty("webdriver.edge.driver", getDriverPath("EDGE"));
      driver = new EdgeDriver(options);
      driver.manage().window().maximize();
Murali S
  • 13
  • 6
  • Does this answers your question https://stackoverflow.com/a/58555433/5400362? – Dev Sep 11 '20 at 10:45
  • I have seen both of these. for the first one, i am trying to do this from code, do not want the registry option. Have tired the second one, hasnt worked – Murali S Sep 11 '20 at 11:30
  • I am not sure whether you are making a test with the MS Edge legacy browser or you are using the MS Edge Chromium browser? Also inform us, which programming language you are using for making this test? If you are using the MS Edge Chromium browser then you can try to make a test with [this example](https://justpaste.it/1rwwi) and let us know whether it worked for you or not. – Deepak-MSFT Sep 14 '20 at 06:04
  • I am using edge chromium and selenium java. I tried something like this (edited question and added details), but still permission pop up is shown on browser – Murali S Sep 16 '20 at 05:36

2 Answers2

0

I suggest you make a test with the sample code below. I tried to test with the Edge Chromium browser and it looks like it is not asking the permission popup.

JAVA code:

public static void main(String[] args) 
 {                            
            System.setProperty("webdriver.edge.driver","\\msedgedriver.exe");       
            EdgeOptions op=new EdgeOptions();
            op.addArguments("use-fake-device-for-media-stream");
            op.addArguments("use-fake-ui-for-media-stream");       
            WebDriver browser = new EdgeDriver(op);
            browser.get("https://your_URL_here...");
 }
Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
  • does addArguments work in selenium 3.141 and selenium edgedriver 3.141? Not finding addArguments in list of options, only setCapability is there. Which edgechromium browser version and driver version r u using – Murali S Sep 24 '20 at 08:02
  • It looks like I am using the Selenium 4.0 alpha version. If possible for you then you can try to make a test with it. It should work with it. – Deepak-MSFT Sep 24 '20 at 08:48
0

In Selenium 3.141 Version we dont have addArguments() method but in Selenium 4.0.0 alpha version we have addArguments() method

EdgeOptions edgeOpts = new EdgeOptions();
edgeOpts.addArguments("allow-file-access-from-files");
edgeOpts.addArguments("use-fake-device-for-media-stream");
edgeOpts.addArguments("use-fake-ui-for-media-stream");
edgeOpts.addArguments("--disable-features=EnableEphemeralFlashPermission");
driver = new EdgeDriver(edgeOpts);