在Chrome 64中允许摄像头和麦克风访问 [英] Allowing Camera and Mic access in Chrome 64

查看:137
本文介绍了在Chrome 64中允许摄像头和麦克风访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了

I've read over this promising thread to try and enable this, but the suggestions aren't working or I'm not following well enough. I tried both methods spelled out in the previous link but no luck. There are no errors in the IDE and Chrome launches fine, but camera and mic still aren't allowed.(details below).

我还应该提到,我不仅在尝试消除弹出窗口,还需要照相机和麦克风来测试我们的应用程序.

I should also mention that I'm not just trying to make the pop up go away, I need the camera and microphone for testing our application.

我正在使用Java 8,Selenium Webdriver 3.8.1,Chrome v.64.

I'm using Java 8, Selenium Webdriver 3.8.1, Chrome v.64.

选项1

ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("C:\\Program Files (x86)\\Google\\Chrome\\Application\\64.0.3282.140\\default_apps\\1.4_0.crx"));
options.addArguments("start-maximized");

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.content_settings.exceptions.media_stream_camera.'https://<oursite>:443,'.setting","1");
prefs.put("profile.content_settings.exceptions.media_stream_mic.'https://<oursite>:443,'.setting","1");
options.setExperimentalOption("prefs", prefs);

System.setProperty("webdriver.chrome.driver", "C:\\Tools\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver(options);

driver.get(<oursite>);

选项2

options.addArguments("user-data-dir=C:\\Users\\<user>\\AppData\\Local\\Google\\Chrome\\User Data\\Default");

感谢您提供的任何帮助(尤其是在可行的情况下).

Thanks for any help offered (especially if it works).

推荐答案

最后,这是一个非常简单的解决方案",以使其对我有效.媒体流的使用伪造的ui"指的是用于媒体流的假UI".参数打开了真实的摄像头和麦克风.

So in the end, it was a very simple 'fix' to make it work for me. The "use-fake-ui-for-media-stream" argument turned on the real camera and mic.

ChromeOptions options = new ChromeOptions();
options.addArguments("use-fake-ui-for-media-stream");

System.setProperty("webdriver.chrome.driver", "C:\\Tools\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver(options);

driver.get(<oursite>);

这篇关于在Chrome 64中允许摄像头和麦克风访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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