I want to automate youtube with selenium and python completely. the following tasks are to be accomplished. the problem is with points number 4 and 6. how to handle them?
open youtube
search any video
play any video
pause the video
like dislike the video.
play the next video
driver = webdriver.Chrome() driver.get('https://www.youtube.com/') Search_Box = driver.find_element_by_xpath('//*[@id="search"]') #search bar speak("opend sir what shoud i search ?") query=takecommand().lower() # query=input('data ?') Search_Box.send_keys(query) Search_Button=driver.find_element_by_xpath('//*[@id="search-icon-legacy"]') #clicked search button Search_Button.click() speak("searched now which one ?") query=takecommand().lower() # query=input('data ?') if "first" in query: video_number = 1 select_video1=driver.find_element_by_xpath(f"(//a[@id='video-title'])[{video_number}]").click() # select_video1.click() elif 'second' in query: video_number = 2 select_video2=driver.find_element_by_xpath(f"(//a[@id='video-title'])[{video_number}]").click() time.sleep(5) speak('pausing video') select_video2=driver.find_element_by_css_selector('movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button').click() #this was for pause,but didnt worked here