from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://yandex.ru/')
s = driver.find_element_by_name('text')
s.send_keys('поисковый запрос')
s.submit()
driver.find_elements_by_class_name('organic__url-text')[0].click()
print(driver.title)
driver.quit()
from selenium import webdriver
search = 'катарсис'
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome(chrome_options=options)
driver.get('https://yandex.ru/')
s = driver.find_element_by_name('text')
s.send_keys(search)
s.submit()
driver.find_elements_by_class_name('organic__url-text')[2].click()
print(driver.title)
driver.quit()