如何从命令行将伪造的媒体流传递给firefox? [英] How can I pass a fake media stream to firefox from command line?

查看:135
本文介绍了如何从命令行将伪造的媒体流传递给firefox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于Java/Selenium的应用程序,需要将媒体(即音频和/或视频文件)传递到浏览器.

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

我已经可以使用以下代码段在Chrome中成功完成此操作:

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);

Firefox 33.1中是否有可用的类似选项来实现相同的功能?

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

如果没有,该怎么办?

推荐答案

Firefox仅具有以下功能, 浏览器名称, browserVersion, platformName, acceptInsecureCerts, pageLoadStrategy, 代理人, setWindowRect, 超时, unhandledPromptBehavior

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);

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

希望它可以帮助您解决这种情况.

Hope it will help you to solve this situation.

这篇关于如何从命令行将伪造的媒体流传递给firefox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆