使用硒进行测试:Chrome屏幕共享自动选择标签并与音频共享 [英] testing using selenium: chrome screensharing auto select tab and share with audio
问题描述
我正在使用Selenium测试我的网站,并且能够使用-auto-select-desktop-capture-source ="tab_name"
打开chrome,并在启用屏幕共享时选择标签.现在,我希望选项卡中播放的音频与视频一起出现在我的视频流中.手动进行操作时,有一个复选框可以启用音频共享,但是是否有一些可以从Selenium中启用它的功能?
I am testing my website 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. Now I 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 is there something which can help enable it from Selenium?
这里是一个小提琴: https://jsfiddle.net/john_vera/yr2k9xob/5/在对话框中选择镶边选项卡后,请注意共享音频复选框.我想从硒中检查一下.
Here is a fiddle: https://jsfiddle.net/john_vera/yr2k9xob/5/ Notice the Share Audio checkbox after selecting chrome tab in the dialog. I want to check that from Selenium.
推荐答案
您可以创建自定义的Chrome构建并为此对话框实现绕过.要生成铬,您可以使用以下说明(适用于Windows):此处
You could create an custom chromium build and implement an bypass for this dialog. To build chromium you can use these instructions (for windows): Here
这是文件display_media_access_handler.cc中的旁路:
Here the bypass in file display_media_access_handler.cc:
寻找这一行:
// Orignal code
pending_request.picker->Show(picker_params, std::move(source_lists), std::move(done_callback));
并替换为此
// Bypass dialog
content::DesktopMediaID screenSource(content::DesktopMediaID::TYPE_SCREEN, content::DesktopMediaID::kNullId, web_contents);
screenSource.audio_share = true;
OnPickerDialogResults(web_contents, screenSource);
// End of bypass
我用Chromium 84版进行测试.
I testet it with Chromium Version 84.
这篇关于使用硒进行测试:Chrome屏幕共享自动选择标签并与音频共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!