I am trying to make an audio file play on google.com. I have the following code:
ChromeOptions options = new ChromeOptions();
options.AddArguments(
//"--allow-file-access-from-files",
"--use-fake-ui-for-media-stream",
//"--allow-file-access",
"--use-file-for-fake-audio-capture=" + AppDomain.CurrentDomain.BaseDirectory + "/audio.wav",
"--use-fake-device-for-media-stream"
);
IWebDriver chrome = new ChromeDriver(options);
this code opens a chrome window with the use of selenium in C# and everything works as expected. When i go to an online audio recorder or https://appr.tc/?debug=loopback then my audio file plays just like it is supposed to do. However, when i go to google.com and I click on the search by voice button at the end of the searchbar nothing happens. (when I just talk then google.com recognizes my voice) What am I missing and why doesn't it work? I am trying to recreate this but in C# http://www.testautomationguru.com/selenium-webdriver-google-voice-search-automation-using-arquillian-graphene/. Is there some kind of javascript code I could execute on the page to make it work? I wouldn't mind using a firefoxdriver instead of a chrome one if that solves the problem.
Thanks
Edit: I found a little more information on https://webrtc.org/testing/ so I suppose this means that google.com doesn't make use of the webrtc getUserMedia() call to get the audio? Any way I could modify the page so it does or can I change some other setting? I also just checked https://speechnotes.co/ and on that site my audio also isn't detected but my real microphone is.
google.com makes use of webKitSpeechRecognition() in javascript which is the built in chrome speech recognition, checkchrome speech recognition WebKitSpeechRecognition() not accepting input of fake audio device --use-file-for-fake-audio-capture or audio file