Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
67 views3 pages

From Selenium Import Webdriver

The document provides a Python script using Selenium to automate the login process for Bank of America. It includes initializing the WebDriver, locating username and password fields, filling them with credentials, and submitting the login form. The script also includes a sleep function to wait for the dashboard to load before closing the browser.

Uploaded by

jass125jaani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views3 pages

From Selenium Import Webdriver

The document provides a Python script using Selenium to automate the login process for Bank of America. It includes initializing the WebDriver, locating username and password fields, filling them with credentials, and submitting the login form. The script also includes a sleep function to wait for the dashboard to load before closing the browser.

Uploaded by

jass125jaani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

from selenium import webdriver

from selenium.webdriver.common.keys import Keys


import time

# Initialize the WebDriver


driver = webdriver.Chrome() # You can replace "Chrome" with the browser
of your choice

try:
# Open the login page
driver.get("https://www.bankofamerica.com/") # Replace
"https://example.com/login" with the actual login page URL

# Find the username and password input fields and fill them with your
credentials
username_input = driver.find_element_by_id("username") # Replace
"username" with the actual ID of the username input field
username_input.send_keys("your_username")

password_input = driver.find_element_by_id("password") # Replace


"password" with the actual ID of the password input field
password_input.send_keys("your_password")

# Submit the login form


login_button =
driver.find_element_by_xpath("//button[contains(text(), 'Log In')]") #
Replace "Login" with the text on the login button
login_button.click()

# Wait for the dashboard page to load (you can adjust the sleep time
as needed)
time.sleep(5) # Wait for 5 seconds to simulate page load

finally:
# Close the browser
driver.quit()

from selenium import webdriver


from selenium.webdriver.common.by import By
import time
import math
# Initialize the WebDriver
driver = webdriver.Chrome() # You can replace "Chrome" with the browser
of your choice
try:
# Open the login page
driver.get("https://www.bankofamerica.com/")

# Find the username input field and fill it with your username
username_input = driver.find_element_by_name("User Id") # Use name
attribute instead of ID
username_input.send_keys("preetixyz")

# Find the password input field and fill it with your password
password_input = driver.find_element_by_name("Password") # Use name
attribute instead of ID
password_input.send_keys("12345678")

# Submit the login form


login_button = driver.find_element_by_id("Log In") # Use ID
attribute for the login button
login_button.click()

# Wait for the dashboard page to load (you can adjust the sleep time
as needed)
time.sleep(5) # Wait for 5 seconds to simulate page load

finally:
# Close the browser
driver.quit()
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import math
# Initialize the WebDriver
driver = webdriver.Chrome() # You can replace "Chrome" with the browser
of your choice

try:
# Open the login page
driver.get("https://www.bankofamerica.com/")

# Find the username input field and fill it with your username
username_input = driver.find_element_by_name("User Id") # Use name
attribute instead of ID
username_input.send_keys("preetixyz")

# Find the password input field and fill it with your password
password_input = driver.find_element_by_name("Password") # Use name
attribute instead of ID
password_input.send_keys("12345678")

# Submit the login form


login_button = driver.find_element_by_id("Log In") # Use ID
attribute for the login button
login_button.click()

# Wait for the dashboard page to load (you can adjust the sleep time
as needed)
time.sleep(5) # Wait for 5 seconds to simulate page load

finally:
# Close the browser
driver.quit()

You might also like