Getting started with Python Selenium

What is Selenium ?

Selenium is an open-source testing tool. It is a functional testing tool and also compatible with non-functional testing tools as well.      
It allows users to stimulate common activities performed bu end users such as entering texts fields, selecting dropdowns values and checking boxes. It also provides various other controls such as mouse clicks and movements, scrolling, Javascript execution etc..

Many companies in the world has already adopted Selenium for their browser-based testing, replacing other tools. 


Selenium Webdriver

Selenium WebDriver is a web framework that permits you to execute cross-browser tests. This tool is used for automating web-based application testing to verify that it performs expectedly. Selenium WebDriver allows you to choose a programming language of your choice to create test scripts. As discussed earlier, it is an advancement over Selenium RC to overcome a few limitations. Selenium WebDriver is not capable of handling window components, but this drawback can be overcome by using tools like Sikuli, Auto IT, etc.

Downloads


Selenium Python

The selenium package is used to automate web browser interaction from Python.

Installing

pip install -U selenium

Usage

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
search = driver.find_element_by_name("q")
search.clear()
search.send_keys("selenium")
search.send_keys(Keys.RETURN)
driver.close()

For more sample codes on selenium python, click here


Comments

Popular Posts