在Python中使用selenium启用“播放DRM”

在Python中使用selenium启用“播放DRM”,python,selenium,firefox,drm,geckodriver,Python,Selenium,Firefox,Drm,Geckodriver,我试图教自己一些python,我一直在做一个使用selenium打开firefox并与netflix交互的项目,但是我需要启用“Play DRM”来流媒体,我在“set_preferences”中没有看到它,我无法在preferences中检查内容页上的元素,所以我不确定如何启用它 import time, pyautogui, os from selenium import webdriver as wd from selenium.webdriver.common.keys import K

我试图教自己一些python,我一直在做一个使用selenium打开firefox并与netflix交互的项目,但是我需要启用“Play DRM”来流媒体,我在“set_preferences”中没有看到它,我无法在preferences中检查内容页上的元素,所以我不确定如何启用它

import time, pyautogui, os
from selenium import webdriver as wd
from selenium.webdriver.common.keys import Keys

profile = wd.FirefoxProfile()
ntfx='http://www.netflix.com/'
driver=wd.Firefox()
driver.get(ntfx)
url = driver.current_url

Ok查看了更多Firefox配置文件,并制作了一个自定义配置文件,如图所示。我进入preferences/content并启用Play DRM,并将路径添加到自定义配置文件中

profile = wd.FirefoxProfile('./fire_fox_profile')
driver=wd.Firefox(profile)

Ok查看了更多Firefox配置文件,并制作了一个自定义配置文件,如图所示。我进入preferences/content并启用Play DRM,并将路径添加到自定义配置文件中

profile = wd.FirefoxProfile('./fire_fox_profile')
driver=wd.Firefox(profile)

作为使用firefox配置文件的替代解决方案,您可以

司机,开始“关于:偏好” 驱动程序。通过“playDRMContent”id查找元素。单击
作为使用firefox配置文件的替代解决方案,您可以

司机,开始“关于:偏好” 驱动程序。通过“playDRMContent”id查找元素。单击
花了4天时间,但最终找到了解决方案

        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.addPreference("media.eme.enabled",true);
        firefoxOptions.addPreference("media.gmp-manager.updateEnabled", true);

然后将firefoxOptions添加到驱动程序中

花了4天时间,但最终找到了解决方案

        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.addPreference("media.eme.enabled",true);
        firefoxOptions.addPreference("media.gmp-manager.updateEnabled", true);

然后将firefoxOptions添加到驱动程序中,@RonanB的方法对我很有效

只需进入firefox中的about:profiles 然后在启用DRM的配置文件下,查找根目录。对我来说是:/home/myusername/.mozilla/firefox/14iw27z4.default-release

所以像这样:

myProfile = webdriver.FirefoxProfile('/home/myusername/.mozilla/firefox/14iw27z4.default-release')
driver = webdriver.Firefox(myProfile)

@RonanB的方法对我有效

只需进入firefox中的about:profiles 然后在启用DRM的配置文件下,查找根目录。对我来说是:/home/myusername/.mozilla/firefox/14iw27z4.default-release

所以像这样:

myProfile = webdriver.FirefoxProfile('/home/myusername/.mozilla/firefox/14iw27z4.default-release')
driver = webdriver.Firefox(myProfile)

你能考虑展示一下你的作品吗?谢谢你考虑展示你的作品吗?谢谢