How can I pass a fake media stream to firefox from command line?

孤街浪徒 提交于 2019-12-03 16:39:06

问题


I am developing a java/selenium based application and need to pass media i.e. audio and/or video files to the browser.

I have been able to successfully do this in Chrome using the below code snippet:

DesiredCapabilities capabilities = DesiredCapabilities.chrome(); 
ChromeOptions options = new ChromeOptions();
options.addArguments("--allow-file-access-from-files",
            "--use-fake-ui-for-media-stream",
            "--allow-file-access",
            "--use-file-for-fake-audio-capture=D:\\PATH\\TO\\WAV\\xxx.wav",
            "--use-fake-device-for-media-stream");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);

Are there similar options available in Firefox 33.1 to achieve the same capability?

If not, how can this be done?


回答1:


Firefox has only these capabilities, browserName, browserVersion, platformName, acceptInsecureCerts, pageLoadStrategy, proxy, setWindowRect, timeouts, unhandledPromptBehavior

But as a option, there is one as in a below code,

options.addPreference("media.navigator.streams.fake", true);

Hope it will help you to solve this situation.



来源:https://stackoverflow.com/questions/31859459/how-can-i-pass-a-fake-media-stream-to-firefox-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!