Automation using selenium: chrome screensharing auto select tab and share with audio option

635 views
Skip to first unread message

Jigar Shah

unread,
Feb 22, 2021, 1:59:13 PM2/22/21
to chromi...@chromium.org, medi...@chromium.org
Hi

Chrome Version : 90.0.4432.0 (Developer Build) (64 Bit)
URLs (if applicable) :
OS version : Linux
Network (such as Cable/DSL/Dial up etc):
Audio/Video format (if applicable):
Special chrome flags (if applicable):

Behavior in Safari (if known):
Behavior in Firefox (if known):

Video issue, Audio issue, both, neither?: both


I have to automatically record audio and video running in particular chrome tab. I am opening tab using Selenium and I am able to open chrome with --auto-select-desktop-capture-source="tab_name" and select the tab when screen share is enabled. I also want the audio playing in the tab to be in my stream along with the video. While doing it manually there is a checkbox which enables audio sharing but to automate audio box selection, I have made changes in chromium code as suggested in following link and rebuild chromium browser to skip pop up and select audio and video true automatically.

https://stackoverflow.com/questions/60178569/testing-using-selenium-chrome-screensharing-auto-select-tab-and-share-with-audi

What is the expected result?
Expecting that pop up window will not shown up on execution of below script and audio option will be considered true automatically and tab will be recorded with audio and video both.

desktopStream = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: true
})

What is the actual result?
On execution of above script, pop up is not getting opened but I am getting following error in console.

uncaught (in promise) DOMException could not start audio source

Any additional information (anything else which may help us debug the
issue)?
Please refer stackover link and first answer where suggested to create custom chrome and code replacement in a particular file. I did same thing and created custom chrome build and using it in selenium with chromerdriver of Linux.

Please suggest the right approach to achieve what I wanted to do if this way is not feasible.

Thanks
Jigar Shah
Reply all
Reply to author
Forward
0 new messages