在 python 中進行簡單的硒測試

from selenium import webdriver

# Create a new chromedriver
driver = webdriver.Chrome()

# Go to www.google.com
driver.get("https://www.google.com")

# Get the webelement of the text input box
search_box = driver.find_element_by_name("q")

# Send the string "Selenium!" to the input box
seach_box.send_keys("Selenium!")

# Submit the input, which starts a search
search_box.submit()

# Wait to see the results of the search
time.sleep(5)

# Close the driver
driver.quit()