from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.google.com") driver.execute_script("alert('Hello World')")
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC driver = webdriver.Firefox() driver.get("https://www.google.com") search_input = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.NAME, "q")) ) driver.execute_script("arguments[0].value = 'Python Selenium'", search_input) search_input.submit()This example uses the WebDriver class to open the Firefox browser, navigate to Google's homepage, and perform a search for "Python Selenium". The execute_script method is used to set the value of the search input using Javascript. The WebDriverWait and expected_conditions classes are used to wait for the search input element to be present on the page before setting its value. Package Library: Selenium.webdriver.remote.webdriver.