I want to scrape the first two videos from the youtube search result, I have a list of words in CSV file I want to get the first two videos for each query, I tried to use selenium python but I get the error , so there is any way to do that.
CODE:
search_input = driver.find_element_by_css_selector('#search').send_keys('')
ERROR:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
There are more than one element when using your selector #search
.
.find_element_by_*
refers to the first element, sadly the input element you are referring to is not the first. The first element with your selector is a hidden element, that's what causes you to get the .....element not interactable
error.
A unique locator for that is input#search
:
driver.find_element_by_css_selector('input#search').send_keys('test')