本文介绍了在Chrome驱动程序中播放DRM内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为播放DRM内容的HTML5播放器编写一些硒测试,当我手动测试时,播放器在Chrome中运行良好,但如果运行我的测试用例,则不会加载或播放最新的Chrome驱动程序。 p>

是否因为drm内容无权在Chrome驱动程序或其他内容中播放?

我有没有问题运行硒测试其他函数。
有什么想法?

解决方案

Chromedriver使用启动Chrome - disable-component-update 默认切换,这会禁用NaCl(本地客户端)支持,而后者又需要加载DRM模块(例如Widevine模块化DRM)。



为了解决这个问题,你需要告诉驱动程序不要使用此开关启动Chrome,方法是使用 excludeSwitches 选项构建驱动程序,指定 disable-组件更新参数。例如(JS):

var webdriver = require('selenium-webdriver'); var chrome = require(selenium-webdriver / chrome ); var capabilities = new webdriver.Capabilities.chrome(); var chromeOptions = {'args':['--user-data-dir = C:/ ChromeProfile'],//以预配置的Chrome配置文件开始' excludeSwitches':['disable-component-update'] //停止破坏Native Client支持}; capabilities.set('chromeOptions',chromeOptions); var driver = new webdriver.Builder()。 withCapabilities(能力)。 build(); driver.get('http:// ...');

或使用Python绑定:

from selenium import webdriver

def buildDriver():
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches',['disable-component-update'])
options.add_argument( '--user-data-dir = C:/ Temp / ChromeProfile')
return webdriver.Chrome(chrome_options = options)

希望有帮助..



- ab1


I'm writing some selenium tests for a HTML5 player playing DRM content, the player works fine in Chrome when I test it manually, but nothing is loaded or played in the latest chrome driver if I run my test cases.

Is it because of the drm content isn't authorized to play in chrome driver or something else?

I have no issues running tests for other functions written in selenium.Any ideas?

解决方案

Chromedriver launches Chrome with --disable-component-update switch by default, which disables the NaCl (Native Client) support, which is in turn required to load DRM modules (e.g. Widevine Modular DRM).

To get around this, you need to tell the driver not to launch Chrome with this switch, by building the driver with excludeSwitches option, specifying disable-component-update parameter. For example (JS):

var webdriver = require('selenium-webdriver');
var chrome = require("selenium-webdriver/chrome");
var capabilities = new webdriver.Capabilities.chrome();

var chromeOptions = {
     'args': ['--user-data-dir=C:/ChromeProfile'], // start with pre-configured Chrome profile
     'excludeSwitches': ['disable-component-update'] // stop breaking Native Client support
};

capabilities.set('chromeOptions', chromeOptions);

var driver = new webdriver.Builder().
    withCapabilities(capabilities).
    build();

driver.get('http://...');

Or using Python bindings:

from selenium import webdriver

def buildDriver():
    options = webdriver.ChromeOptions()
    options.add_experimental_option('excludeSwitches', ['disable-component-update'])
    options.add_argument('--user-data-dir=C:/Temp/ChromeProfile')            
    return webdriver.Chrome(chrome_options=options)

Hope that helps..

-- ab1

Issue 886: Enabled PNaCl Components in ChromeDriver - Enhancement

这篇关于在Chrome驱动程序中播放DRM内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 21:13