【问题标题】:--use-file-for-fake-audio-capture doesn't play on google.com--use-file-for-fake-audio-capture 无法在 google.com 上播放
【发布时间】:2018-11-18 10:33:45
【问题描述】:

我正在尝试在 google.com 上播放音频文件。我有以下代码:

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);

此代码使用 C# 中的 selenium 打开一个 chrome 窗口,一切正常。当我使用在线录音机或https://appr.tc/?debug=loopback 时,我的音频文件会按预期播放。但是,当我访问 google.com 并单击搜索栏末尾的语音搜索按钮时,什么也没有发生。 (当我只是说话时,google.com 会识别出我的声音)我错过了什么,为什么它不起作用?我正在尝试重新创建它,但在 C#http://www.testautomationguru.com/selenium-webdriver-google-voice-search-automation-using-arquillian-graphene/ 中。我可以在页面上执行某种 javascript 代码以使其工作吗?如果可以解决问题,我不介意使用 Firefox 驱动程序而不是 chrome 驱动程序。

谢谢

编辑:我在https://webrtc.org/testing/ 上找到了更多信息,所以我想这意味着 google.com 没有使用 webrtc getUserMedia() 调用来获取音频?有什么办法可以修改页面,或者我可以更改一些其他设置吗?我也刚刚检查了https://speechnotes.co/,在那个网站上我的音频也没有被检测到,但我真正的麦克风是。

【问题讨论】:

    标签: selenium google-chrome-devtools webrtc


    【解决方案1】:

    google.com 使用了 javascript 中的 webKitSpeechRecognition(),它是内置的 chrome 语音识别,checkchrome speech recognition WebKitSpeechRecognition() not accepting input of fake audio device --use-file-for-fake-audio-capture or audio file

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      • 2020-08-10
      相关资源
      最近更新 更多