I am trying to use selenium web driver to open up Google search for Youtube and then click on the Youtube link. (I know I could go straight there but this is a proof of concept) I have played around with different solutions, but I keep having problems locating the Youtube link for me to click on.
Here is what I have:
driver = webdriver.Chrome()
driver.get("https://google.com")
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("youtube")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
link = driver.find_element_by_link_text('YouTube')
link.click()
I can't get the HTML to recognize so just inspect it on google to see the HTML for Youtube.
Also answers in python would be appreciated.