Selenium configuration with Python in Eclipse & Login Script.

  1. Download python as per your OS. Example: download python for windows
  2. Run exe
  3. You can customize your python install folder either installed on default directory.
  4. Check python version, open command line and type Python:

C:\Users\****>python
Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

5. install selenium

6: install eclipse

7. open eclipse > go to marketplace > search for PyDev > install it.

8. create a new project as Python Project

9. copy the latest chrome driver into project directory

from selenium import webdriver
from selenium.webdriver.common.by import By
import time
print(“test case started”)

open Google Chrome browser

driver = webdriver.Chrome()

maximize the window size

driver.maximize_window()

delete the cookies

driver.delete_all_cookies()

navigate to the url

driver.get(“http://********/login”)
time.sleep(2)

identify the user name text box and enter the value

username = driver.find_element(By.NAME,”username”)
username.send_keys(“*****”)
time.sleep(2)

identify the password text box and enter the value

password = driver.find_element(By.NAME, “password”)
password.send_keys(“******”)

click on the login button

login = driver.find_element(By.ID, “login-btn”)
login.click()
time.sleep(3)

close the browser

driver.close()
print(“login has been successfully completed”)

10. run the Test.py by command line

11. run the Test.py in eclipse as Run As > Python Run

There are no comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Start typing and press Enter to search

Shopping Cart

No products in the cart.