I am new to Python and to Selenium and was running into a problem using this simple program:
from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:/Users/Marc/Desktop/Chromedriver/chromedriver.exe")
#open google
driver.get("https://www.google.de")
#search for test
driver.find_elements_by_name("q").send_keys("test")
driver.find_elements_by_name("btnK").click()
It just should open the google webpage in Chrome and initiate a search for the word "test". However when opening the webpage a new element pops up informing about data security and cookies and the search is not executed -> "AttributeError: 'list' object has no attribute 'send_key". (As far as I understand it the reason for the pop up is due to the fact that the browser run by chromedriver doesn't use any of the preexisting cookies.)
How can I solve this? I already tried to us the switch_to_alert method but it didn't work out.
edit: For me it is not about the google website itself but how to deal with it in general as it could occur on other websites as well. Why can't I perform an action on this element? or how can I?
Thanks for your help in advance!