Created
February 26, 2023 22:48
-
-
Save kuznetsov-m/3ed355b51f6a962759e09d12c7887b69 to your computer and use it in GitHub Desktop.
Python Selenium Chrome webdriver example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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