# Selenium 3
from selenium import webdriver
# Selenium 4
from selenium import webdriver
from selenium.webdriver.common.by import By
# Selenium 3
driver = webdriver.Chrome()
# Selenium 4
options = webdriver.ChromeOptions()
options.add_argument("--headless")
driver = webdriver.Chrome(options=options)
# Selenium 3
button = driver.find_element(By.ID, "submit")
time.sleep(5) // wait for page to load
button.click()
# Selenium 4
button = driver.find_element(By.ID, "submit")
driver.execute_async_script("""
let button = arguments[0];
button.click();
""", button)
You may also like: