mit
mit

Reputation: 44

Is there a way to allow chrome use your camera and microphone for selenium script? I don't want to pass fake stream

I am aware of ChromeOptions and passing fake media stream options.addArguments("use-fake-device-for-media-stream"); options.addArguments("use-fake-ui-for-media-stream");

But I don't want to pass fake media. I want to use my laptop's camera

Upvotes: 2

Views: 386

Answers (1)

Asmoun
Asmoun

Reputation: 1747

try this :

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("media.default_video_capture_Device", "\\\\?\\root#media#0002#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global");
options.setExperimentalOption("prefs", prefs);

Camera code could be obtained from settings window (inspect with dev tools) or from preferences file in Chrome directory.

Upvotes: 1

Related Questions