- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Fill username and password using selenium in python.
We can fill username and password fields in a login page with Selenium. This is considered an authentication step for any application. Once the username and password is entered, we have to click the login button.
Example
Code Implementation.
import time from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") driver.get("https://mail.rediff.com/cgi-bin/login.cgi") # identify username, password and signin elements driver.find_element_by_name("login").send_keys("tutorialspoint") time.sleep(0.2) driver.find_element_by_name("passwd").send_keys("pass123") time.sleep(0.4) driver.find_element_by_class_name("signinbtn").click() driver.close
If a valid username and password is provided, we shall be directed to the home page of the application.
Output
- Related Articles
- Gmail login fail using Selenium webdriver. Showing element not found for password.
- Select iframe using Python and Selenium
- C++ program to define exception for small username, and validate username
- Password validation in Python
- Running javascript in Selenium using Python.
- getpass() and getuser() in Python (Password without echo)
- Strong Password Checker in Python
- Using Extensions with Selenium & Python
- Fetch all href link using selenium in python.
- Get text using selenium web driver in python?
- How to save and load cookies using Python Selenium WebDriver?
- How can I parse a website using Selenium and Beautifulsoup in python?
- How to set window size using phantomjs and selenium webdriver in Python?
- Validating a password using JavaScript
- How to get username using ID from another table in MySQL database?

Advertisements