Answer the question
In order to leave comments, you need to log in
How can I record audio from a browser tab using Python + Selenium?
Good afternoon! I am writing a program in Python + Selenium that works with a site that plays music. The program sets parameters for music (on/off instruments, etc.).
Tell me, please, how can I automatically record audio from this tab?
Answer the question
In order to leave comments, you need to log in
1. Record audio from the system audio playback device. I think that for Linux and for Windows there are solutions with virtual sound devices that will write everything to a file for you.
2. Because Selenium runs regular Chrome, then take any Chrome extension that can record audio that sounds in a bookmark, it will record what you need. The only difficulty is to start recording and stop ... I honestly did not try to interact with extensions through Selenium, most likely you can automate clicks on extension controls. Or maybe there are extensions that record everything automatically.
And more, because any Chrome extension is JS, then I think you can manage all of them (extensions) through execute_script, but you need to figure out the API of a particular extension.
3. You can make your own Chrome bookmark sound recorder ... in Chrome, in general, this feature is already built in https://developers.google.com/web/updates/2016/01/... (if it is included in the stable branch, of course, that I didn't understand right off the bat.) But in extreme cases, you can take the code of any extension and see how it works, but right there and it may be easier to do step 2.
I can tell you how to install a Chrome extension on startup from Selenium.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question