I am using Selenium 4 in java to control Chrome and Edge and other browsers in order to test a video call app. I have a test where I’m starting up 2 different browsers at once in order to get them to communicate with each-other. I am using OBS to provide virtual webcams with customizable feeds so that I can switch input for either browser.
When I start up 2 Chromium-family browsers I get an issue that only the first one I launch (at a time) can get and show the full list of cameras while the other one shows nothing – even after waiting 15+ minutes. If I launch Firefox and Chrome as my browsers then they both can access the webcam list.
Since Firefox is not planned to be supported for the first version of the webapp, that leaves mostly chromium family browsers for me to test with (I’m on windows so I can’t test safari at this point). Does anyone know why this is happening and how I could fix it?
How I start Chrome:
ChromeOptions chromeOptions= new ChromeOptions();
chromeOptions.addArguments(“use-fake-ui-for-media-stream”);
chromeDriver = new ChromeDriver(chromeOptions);
How I start Edge:
EdgeOptions edgeOptions= new EdgeOptions();
edgeOptions.addArguments(“use-fake-ui-for-media-stream”);
edgeDriver = new EdgeDriver(edgeOptions);
How I start Firefox:
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addPreference(“browser.cache.disk.enable”, false);
firefoxOptions.addPreference(“browser.cache.disk.capacity”, 0);
firefoxOptions.addPreference(“browser.cache.disk.smart_size.enabled”, false);
firefoxOptions.addPreference(“browser.cache.disk.smart_size.first_run”, false);
firefoxOptions.addPreference(“browser.sessionstore.resume_from_crash”, false);
firefoxOptions.addPreference(“browser.startup.page”, 0);
firefoxOptions.addPreference(“media.navigator.permission.disabled”, true);
firefoxOptions.addPreference(“device.storage.enabled”, false);
firefoxOptions.addPreference(“media.gstreamer.enabled”, false);
firefoxOptions.addPreference(“browser.startup.homepage”, “about,blank”);
firefoxOptions.addPreference(“browser.startup.firstrunSkipsHomepage”, false);
firefoxOptions.addPreference(“extensions.update.enabled”, false);
firefoxOptions.addPreference(“app.update.enabled”, false);
firefoxOptions.addPreference(“network.http.use-cache”, false);
firefoxOptions.addPreference(“browser.shell.checkDefaultBrowser”, false);
firefoxDriver = new FirefoxDriver(firefoxOptions);
Source: Read More