Most first push
Then input some text and search.
Code is old,have to setup chrome driver(in a OS path) first in code.
Old way
Here a working test.
accept all
button.Then input some text and search.
Code is old,have to setup chrome driver(in a OS path) first in code.
Old way
find_element_by_xpath
new find_element(By.XPATH, 'tag')
.Here a working test.
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By import time # Setup #https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6154.0/win64/chromedriver-win64.zip" options = Options() #options.add_argument("--headless=new") ser = Service(r"C:\cmder\bin\chromedriver.exe") browser = webdriver.Chrome(service=ser, options=options) # Parse or automation url = "https://www.google.com/" browser.get(url) time.sleep(3) accept_bt = browser.find_element(By.CSS_SELECTOR, '#L2AGLb') accept_bt.click() input_field = browser.find_element(By.CSS_SELECTOR, '#APjFqb') input_field.send_keys('car') time.sleep(3) search_bt = browser.find_element(By.XPATH, 'input.gNO89b') search_bt.click()