Quality Testing

Quality is delighting customers

How to Do Selenium automation testing with the help of Python?

Hello All,

Please share your thoughts about How to Do Selenium automation testing with the help of Python, Just started some new things during this lockdown...

I also got the good source of information like: Selenium Automation Testing Using Python

You have anything more for me...

Views: 56

Reply to This

Replies to This Discussion

Hi Priti,

Before starting Selenium automation in python:

First you need to cover these points:
1. What is Python?
2. Why is Python useful for automation testing?
3. Selenium with Python
4. Configure Selenium using Python
5. Configure PyDev in Eclipse

Once these steps are done, you can write and execute a simple selenium test script e.g. Login script

Here is one example: Login to Gmail Application

from Selenium import webdriver
import time
from Selenium.webdriver.common.keys import Keys
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("https://www.gmail.com")

#identify the user name text box and enter the value
driver.find_element_by_id("identifierId").send_keys("xyz11@gmail.com")
time.sleep(2)

#click on the next button
driver.find_element_by_xpath("//span[@class='RveJvd snByac'][1]").click()
time.sleep(3)

#identify the password text box and enter the value
driver.find_element_by_name("password").send_keys("#########")
time.sleep(3)

#click on the next button
driver.find_element_by_xpath("//span[contains(text(),'Next')][1]").click()
time.sleep(3)

#close the browser
driver.close()
print("Gmail login has been successfully completed")

You can further refer this page software testing company to understand more about python Automation. 
 

Hope it helps!

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service