jeudi 27 février 2020

Web automation using selenium and python - opening youtube video link

I'm trying to open a youtube video. After navigating to the search results, I'm unable to open the desired link. it's not accepting the xpath for searchBaari. Any help would be appreciated.

Here is the code:

from selenium import webdriver

driver = webdriver.Chrome('/Users/souravroy/Downloads/chromedriver-2')

driver.get('https://youtube.com')

searchbox = driver.find_element_by_xpath('//*[@id="search"]')

searchbox.send_keys('Baari')

searchButton = driver.find_element_by_xpath('//*[@id="search-icon-legacy"]/yt-icon')

searchButton.click()

driver.implicitly_wait(4500)

searchBaari = driver.find_element_by_xpath('//*[@id="Baari Lyrics Translation"]/yt-formatted-string')

searchBaari.Click()




Aucun commentaire:

Enregistrer un commentaire