

Note: You can still use the Chrome instance started by the Chrome WebDriver for browsing in other tabs. > # And just click to play/pause your video: > video = driver.find_element_by_id("player-api") > # Let selenium find the player container > driver = webdriver.Chrome(os.path.expanduser('~/chromedriver'), chrome_options=chrome_options) > chrome_options.add_argument("-disable-sync") Type "help", "copyright", "credits" or "license" for more information.

Then start the chromedriver from python, open a terminal and type: $ python Install the following dependency: sudo apt-get install python-seleniumĪnd download the Chromedriver from here, select the one corresponding to your architecture e.g:Įxtract the chromedriver file for example in your $HOME folder. On Desktop (Mac, Linux, Windows and ChromeOS). ChromeDriver is available for Chrome on Android and Chrome Standalone server which implements WebDriver's wire protocol forĬhromium. Pages, user input, JavaScript execution, and more. It provides capabilities for navigating to web WebDriver is an open source tool for automated testing of webappsĪcross many browsers. You could start the Chrome session (with your Youtube playlist) using the Chrome WebDriver: If controlling YouTube with your media keys is what you're after, there seem to be some extensions out there that claim to add this functionality to Chrome: # restore previously active window/desktop # activate Chrome YouTube window and send keyboard event Xdotool search -name YouTube windowactivate ] & xdotool windowactivate "$ActiveWindowID"

# Activating the root window (Desktop) results in an error message, so we # Dependencies: xdotool (sudo apt-get install xdotool)ĪctiveWindowID="$(xdotool getactivewindow)"ĪctiveWindowName="$(xdotool getwindowname "$ActiveWindowID")" The following script might work for you #!/bin/bash The downside to this method is that you have to activate the window before sending the key-press (Chrome ignores keyboard input when it isn't focused).

Well, I guess you could always use a tool like xdotool to send a k key-press to your YouTube window.
