["python","selenium"]
Fill username and password using selenium in python

How can I auto fill the username and password over the link below: from selenium import webdriver from selenium.webdriver.common.keys import Keys chromedriver = 'C:\\chromedriver.exe' browser = webdriver.Chrome(chromedriver) browser.get('http://www.example.com') After that I really do not know: username = Select(browser.find_element_by_name('Username')) password = Select(browser.find_element_by_name('Password')) username.select_by_visible_text("text") password.select_by_visible_text("text")
Docs: https://selenium-python.readthedocs.io/navigating.html For versions 4.3.0 (released in June 2022) and later, calls to find_element_by_* and find_elements_by_* were removed from Selenium. You need to use the new API: from selenium.webdriver.common.by import By driver = webdriver.Firefox(...) # Or Chrome(), or Ie(), or Opera() # To catch <input type="text" id="passwd" /> password = driver.find_element(By.ID, "passwd") # To catch <input type="text" name="passwd" /> password = driver.find_element(By.NAME, "passwd") password.send_keys("Pa55worD") driver.find_element(By.NAME, "submit").click() The original response, for API versions 4.2.0 or previous: driver = webdriver.Firefox(...) # Or Chrome(), or Ie(), or Opera() username = driver.find_element_by_id("username") password = driver.find_element_by_id("password") username.send_keys("YourUsername") password.send_keys("Pa55worD") driver.find_element_by_name("submit").click() A note to your code: Select() is used to act on a Select Element (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select).