from selenium.webdriver import Chrome driver = Chrome() driver.get("https://www.google.com/") search_bar = driver.find_element_by_id("lst-ib") search_bar.send_keys("Python selenium")
from selenium.webdriver import Firefox driver = Firefox() driver.get("https://www.facebook.com/") email_field = driver.find_element_by_id("email") password_field = driver.find_element_by_id("pass") email_field.send_keys("[email protected]") password_field.send_keys("mysecret")In this example, we are using `find_element_by_id()` to locate the email and password fields on Facebook's login page with ID attribute values "email" and "pass", respectively. We then use the `send_keys()` method to enter our email and password. As mentioned earlier, the `find_element_by_id()` method is provided by the `selenium.webdriver.remote.webdriver` package library in Python.