FuckTheWorld / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Python - Selenium Chrome webdriver doesn't have components like WidevineCDM #1140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:
I'm trying to use Selenium to open a page and go to Netflix and open a video 
and play. Once I actually get to the video, I can't load it because I get the 
error:

Missing Components... Please visit chrome://components, locate the WidevineCdm 
component...

When going to chrome://components, there aren't any components installed. If I 
had opened Chrome regularly and navigated to the video like I did in Selenium, 
I can play it. When I got to chrome://components in regular Chrome, there are 
more components in there. I'm trying to find out how to import my normal Chrome 
settings but I can't seem to figure that out. I've tried using ChromeOptions 
and DesiredCapabilities.CHROME but I couldn't get it to work. I also can't find 
documentation on all the items inside the DesiredCapabilities.CHROME 
dictionary. I hope that once I'm able to get normal Chrome settings into the 
webdriver version, I'd be able to load Netflix videos via Selenium Chrome 
webdriver.

Steps to reproduce (if relevant, you MUST provide a simplified html page or
link to public site):

driver = webdriver.Chrome()
driver.get("https://www.netflix.com/")

user = "MY_NETFLIX_EMAIL"
passw = "MY_NETFLIX_PASSWORD"

signinButton = "//*[contains(text(), 'Sign In')]"
SIB = WebDriverWait(self.driver, 10).until(lambda driver: 
self.driver.find_element_by_xpath(signinButton))
SIB.click()

emailField = "email"
passField  = "password"
loginButton = "login-form-contBtn"
EF = WebDriverWait(self.driver, 10).until(lambda driver: 
self.driver.find_element_by_name(emailField))
PF = WebDriverWait(self.driver, 10).until(lambda driver: 
self.driver.find_element_by_name(passField))
LIB = WebDriverWait(self.driver, 10).until(lambda driver: 
self.driver.find_element_by_id(loginButton))

EF.clear()
PF.clear()
EF.send_keys(user)
PF.send_keys(passw)

LIB.click()

account = "profileName"
accButton = WebDriverWait(self.driver, 10).until(lambda driver: 
self.driver.find_element_by_class_name(account))
accButton.click()

chooseShow = "playRing"
pick = WebDriverWait(self.driver, 10).until(lambda driver: 
self.driver.find_element_by_class_name(chooseShow))
pick.click()

I don't get a run time error or anything, what I get is more of an error within 
the browser due to lack of components. The exact error message from Chrome is:

Whoops, something went wrong...

Missing Component

We cannot find all the required components to play Netflix on this device. 
Please visit chrome://components, locate the WidevineCdm component, and click 
the "Check for update" button.

As stated in the description, I can't seem to find any way to import the 
components. In regular Chrome, is see that there is a WidevineCdm component AND 
plugins. What I also notice is that there is not a WidevineCdm extension. I am 
however able to add that extension into the Chrome driver using the following 
command before setting up the driver:

options = webdriver.ChromeOptions()
options.add_argument("load-extension=C:\\Users\\MYCOMP\\AppData\\Local\\Google\\
Chrome\\User Data\\WidevineCDM\\1.4.8.823")
self.driver = webdriver.Chrome(desired_capabilities=options.to_capabilities())

But this doesn't do anything really to help solve my problem.

Original issue reported on code.google.com by bhn2...@gmail.com on 30 Jun 2015 at 3:06

GoogleCodeExporter commented 9 years ago
Issue 1141 has been merged into this issue.

Original comment by gmanikp...@chromium.org on 30 Jun 2015 at 5:07

GoogleCodeExporter commented 9 years ago
bhn2600@

thanks for filing bug, can you please try this workaround and let me know if 
this helps you:- 

'''
manually start chrome from terminal/command prompt with these command line 
arguments --
google-chrome 
--user-data-dir=/path/to/any/custom/directory/home/user/Desktop/Chromedir 
--profile-directory="Profile 1" --remote-debugging-port=7878

1. make sure "Profile 1" is already existing in the same --user-data-dir (make 
usre Profile 1 has necessary chrome://components/ to run Netflix when launched 
manually)
2. you can use any free port in place of 7878
verify that http://localhost:7878 is running and returns value.
now connect to the remote-debugging-port=7878 via chromedriver with code below
Verify chrome://components/

'''

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

cr_options = Options()
cr_options.add_experimental_option('debuggerAddress','127.0.0.1:7878')
browser = webdriver.Chrome(chrome_options=cr_options)
browser.get('https://www.google.com')
browser.get('chrome://components/')

Original comment by agau...@chromium.org on 1 Jul 2015 at 10:08

GoogleCodeExporter commented 9 years ago
Thanks for the help, that works perfectly fine! This workaround is sufficient. 

Original comment by bhn2...@gmail.com on 1 Jul 2015 at 5:16

GoogleCodeExporter commented 9 years ago
bhn2600@

thanks for the update, closing this bug for now. please file new bug if there 
is any issue observed in chromedriver.

thanks

P.S:- 
When chrome is launched via ChromeDriver it creates temporary user directory 
and profile:- like --user-data-dir=/tmp/.com.google.Chrome.weHzZr.
this temporary profile may not include all chrome components or players as it 
does when launched manually. hence some functions of chrome may have different 
behavior. 

to resolve this problem, we can connect to existing chrome session with the 
help of ChromeOptions debuggerAddress.

Original comment by agau...@chromium.org on 2 Jul 2015 at 8:13