Search code examples
pythonseleniumfirefoxdrmgeckodriver

Enabled 'Play DRM' using selenium in Python


I'm trying to teach myself some python and I've been working on a project which uses selenium to open firefox and interact with netflix but I need to enable 'Play DRM' to stream, I dont see it in 'set_preferences' and I cant inspect element on the contents page in preferences so I'm not sure how to enable it.

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

Solution

  • Ok looked more into the Firefox Profiles and made a custom profile as show here. I went into preferences/content and enabled "Play DRM" and added the PATH to the custom profile

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