Getting Started with Selenium Test cases in Python - Part 4

In this tutorial, we are going to learn about the How to write the Selenium Testcases in Python. We will discuss about the Waits while creating Test cases for the below statement.

We have one demo where we are written the test cases in Python and understand it.

This is a Part 4 of the series Getting Started with Selenium Test cases in Python.

Thanks for reading! 🙂 If you enjoyed it, hit that share button below. Would mean a lot to me and it helps other people see the story.

1,122 total views, no views today


Getting Started with Selenium Testcases in Python – Part 3

In this tutorial, we are going to learn about the How to write the Selenium Testcases in Python. We are going to cover the how to do Navigation, Locators, Drag and Drop and other Concepts.

We have one demo where we are written the test cases in Python and understand it.

We are going to automate to make an appointment in the system using Selenium Python.

This is a Part 3 of the series Getting Started with Selenium Testcases in Python

Slides  –

Thanks for reading! 🙂 If you enjoyed it, hit that share button below. Would mean a lot to me and it helps other people see the story.

996 total views, no views today


Getting Started with Selenium Python – Part 2 (Unittest module)

The Python unit testing framework, sometimes referred to as “PyUnit,” is a Python language version of JUnit, by Kent Beck and Erich Gamma. JUnit is, in turn, a Java version of Kent’s Smalltalk testing framework. Each is the de facto standard unit testing framework for its respective language.

1,174 total views, 6 views today


Step by Step Selenium With Python – Part 1

In this series, We going to learn about the create a Test Suite in the Python. Let’s not waste much of the time lets start as quickly as possible.

Things you know before.

1. Selenium – Testing Framework
2. Python – Basic Python Syntax. – Please install it before proceeding.
3. Brain 😛

About Selenium :

Running selenium server

If you have no clue what is selenium is,Read about Selenium in my other tutorials or you can have a look here for the more, Just for the quick reference, Selenium is Automation framework written in the java that allows you to automate the web application with the different languages support e.g Python,Javascript, Java, Ruby.You can write functional/acceptance tests using Selenium WebDriver.


Installing Python bindings for Selenium

Running selenium serverGo to Command prompt or Terminal in the Mac and Type.
Make sure pip is installed on your system.(If not you can install it using this link here)

It will install the python binding for the selenium  to your system.

Step 1 : Running Selenium Server and Install Python Selenium bindings

Let’s run the Selenium Server that listens to our command/Test cases written python and execute them in the browser. Make sure java is installed on your system and its available in the path. If not follow this tutorial. And set up to path here
Download – Selenium server here.

You will see something like this on the command line.

Running selenium server

Selenium Server is up and Running.

Step 2 : Creating a Basic Test in the Selenium with Python and Run it.

Create a File in the Pycharm ( Python Editor) e.g I have made a Folder structure for the upcoming  tutorials also. So This part is Part 1 and I have one file that will have the code for the First Test case in python.

In the File, we are going

1. Import the selenium web driver.
2. Create a driver object from FirefoxDriver Class and Open the Borwser.
3. Use get method to go to the URL.
4. Assert the title and Close the Brower.

Run the Test by

File run using python:

Python test running using Pycharm

Python test running using Pycharm

So we have successfully run our first Test, Let’s move to the other Tutorial in the Next Part2.
Hope to see you guys in the next part.


Learning Python Smart Way : Numbers & Strings

In this series of blogs we will learn python , But in a smart way, I mean by smart way  learning  python learning deep with basics and learn only needful things that we are going to implement in future project and in more practical manner.

Here I discussed about Installing Python and Starting IDLE . Lets start with Numbers and Strings.

Numbers  :-

We will learn about following topics :-

1. Type of Number in Python.
2. Arithmetic operations.
3. Assignment of Object

Type of Number in Python :-

In python , We have lots of type of numbers,  I will mainly discuss about Integers and Floating point numbers.
Integer example is  1. –2 etc and Floating point number is 3.01 etc.

Basic Operations example :

Arithmetic operations:-

Note : In python 2, If you divide 3/2 you will get the integer by in python 3 you will get the float value.

In you have python 2 installed , You can import division module from  “__future__” to get the Floating point number.

Assignment of Object:-

In python , Lets create some variables, In python we can assign any data type  to a variables that why I love python most.
Using print(“ ”) function to print values e.g variables in the below image.

The names you use when creating these labels need to follow a few rules:

  1. Names can not start with a number.
  2. There can be no spaces in the name, use _ instead.
  3. Can’t use any of these symbols :'”,<>/?|\()!@#$%^&*~-+.
  4. It’s considered best practice (PEP8) that the names are lowercase.

Strings :-

Lets learn following topics in strings.

  1. Creating & Printing Strings
  2. String Indexing and Slicing
  3. String Properties &  Methods
  4. Formatting Print
Creating & Printing Strings

String Indexing and Slicing

We can use a : to perform slicing which grabs everything up to a designated point.

Note :  The slicing Here we’re telling Python to grab everything from 1 up to 2. It doesn’t include the 2rd index. You’ll notice this a lot in Python, where statements and are usually in the context of “up to, but not including”.

We can also use index and slice notation to grab elements of a sequence by a specified step size (the default is 1). For instance we can use two colons in a row and then a number specifying the frequency to grab elements. For example:

# Grab everything, but go in steps size of 1.
# Grab everything, but go in steps size of 2
# We can use this to print a string backwards by (-1)

String Properties &  Methods

Its important to note that strings have an important property known as immutability.

s = ‘Hello World’
# Let’s try to change the first letter to ‘x’
s[0] = ‘x’

Formatting Print

That’s all folks , In next series we will learn about List, Dictionaries and Tuples.


Using Appium with Python : Introduction

In this series of blogs, I will discuss about the appium (test automation framework  for mobile apps). We will discuss about how you can
automate your android mobile apps and save your testing hours. I will cover appium with python client and for android only.

Appium is an open source test automation framework for use with native, hybrid and mobile web apps.It drives iOS and Android apps using the WebDriver protocol.

Here is the basic architecture of Appium , How it interact with Android / ios client.

System Installation


On Windows Appium Installation :
Please install these basic requirements that are import run Python client in Appium.
  1. PyCharm( python editor)
  2. Appium.exe
  3. Python 2.7 or 3.0 (Pip configured)
  4. Python client Appium
  5. Android SDK install latest(Added to Path).
  6. Java – Added to Path(Optional)
  7. Selenium module of python
  8. unittest /nose module of python.

Make sure you set up environment variables correctly before executing any script. All these variables should be set under ‘System variables’ not in ‘User variables’.

  • C:\Program Files\Java\jdk1.8.0_25
  • D:\Android_Development\android_sd
  • PATH variable (this contain System32 , platform-tools , tools ,jdk bin set) –
    • C:\Windows\System32;D:\Android_Development\android_sdk\platform-tools;%JAVA_HOME%\bin;D:\Android_Development\android_sdk\tools;

Installing Selenium and Python Appium client.

Make sure you have pip install on windows(Check out my other post how you can do this).

Now you are ready to write your first Test case using python client in Appium. In the next blog We will write a basic test program that open a  App and Do certain task and close it after. Please comment down if you face any issue or need help.