Skip to content

Instantly share code, notes, and snippets.

@kuznetsov-m
Created February 26, 2023 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuznetsov-m/3ed355b51f6a962759e09d12c7887b69 to your computer and use it in GitHub Desktop.
Save kuznetsov-m/3ed355b51f6a962759e09d12c7887b69 to your computer and use it in GitHub Desktop.
Python Selenium Chrome webdriver example
# Chrome webdriver: https://sites.google.com/chromium.org/driver/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
options = Options()
options.headless = False
driver = webdriver.Chrome(
service=Service('driver/chromedriver'),
options=options
)
driver.get('https://www.google.com/')
content = driver.find_element(By.CLASS_NAME, 'gLFyf')
content.click()
content.send_keys('bla bla bla')
content.send_keys(Keys.ENTER)
import time
time.sleep(10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment