I'm trying to create a Python3 script using selenium that opens a youtube video, then skips the add. I tried using this:
self.driver.find_element_by_xpath('//*[@id="skip-button:8"]/span/button')\
.click()
But it would just pause the video, because I think the mouse needs to be hovering the button before clicking it. Here is the class that will do this:
class MusicPlayer():
def __init__(self):
self.driver = webdriver.Safari()
self.driver.get("https://www.youtube.com/watch?v=suia_i5dEZc")
sleep(10)
self.driver.find_element_by_xpath('//*[@id="skip-button:8"]/span/button')\
.click()
sleep(260)