Hello Everyone,
Our web-app has a feature of taking a picture using a web-cam for identity verification. Currently, we don't have an option to upload a file. I am trying to automate this feature using Cypress but facing this issue.
Issue: The app throws a message saying "Couldn't access camera. Please allow access to your device's camera"
Troubleshooting: I've tried the below options to resolve this issue but none of them seem to be working
1. Based on the Cypress documentation , a default set of chrome switches are being passed before the browser is launched, among them we have '--use-fake-ui-for-media-stream' and '--use-fake-device-for-media-stream**' which would fake the UI/Device. I've filtered them in the config file.
launchOptions.args = launchOptions.args.filter((arg) => {
return arg !== "--use-fake-device-for-media-stream" && arg !== "--use-fake-ui-for-media-stream"
})
2. Also, the browser does not throw a prompt asking for camera permissions. In the cypress documentation it specifically says a switch has been added that would 'Disables prompts requesting permission to use devices like cameras or mics'. On researching, found that the corresponding switch for this is '--use-fake-device-for-media-stream'
3. Tried using an open-source library (
https://github.com/kamranayub/cypress-browser-permissions) for setting the camera permissions.
4. I've tried the same feature in Webdriver using the same Chrome version (v109) and it does prompt for camera permissions.
Data Cypress version: 10.3.0 Chrome version: 109
I cannot share the source-code.
Any suggestions are appreciated.