I am currently working on writing automated tests using Selenium and Javascript. I would like to test screen sharing feature on our app with Firefox. I would like to know how to use a fake device for this similar to these Chrome options:
'--use-fake-device-for-media-stream',
'--use-fake-ui-for-media-stream',
'--enable-usermedia-screen-capturing',
'--auto-select-desktop-capture-source="Entire screen"',
I am using the following arguments for Firefox options:
'media.navigator.permission.disabled': true,
'media.webrtc.hw.h264.enabled': true,
'media.getusermedia.screensharing.enabled': true,
'media.navigator.streams.fake': true,
'media.peerconnection.video.h264_enabled': true
The tests work on my local machine with and without headless mode. However it fails in CI using Github Actions. I noticed the screen sharing is actually sharing my own screen, so I assume the fake device didn't work for screen sharing (it works for camera and microphone by the way).
Environment:
- Selenium 4.12
- Firefox 117 (gecko driver and Firefox are provided by Selenium)