Python Selenium Tutorials


Selenium Tutorials

In this series of tutorials, we focus on working with Selenium for web automation in Python programming language.

The tutorials cover all the topics from basics to advanced concepts of Selenium with Python.

Get Started

Get started with an introduction to Selenium, and how to work with Selenium in Python, and then we write our first program with Selenium in Python.

Browser window with Selenium

The following tutorials cover scenarios where we interact with the browser window using Selenium.

Basics

Interacting with webpage and related actions

The following tutorials cover scenarios where we automate some of the actions that we do on a webpage using Selenium.

Locating elements

In the following tutorials, we will learn how to locate or find an element by id, class name, link text, name, partial link text, tag name, or XPath, in the given document, using find_element() function.

  • Overview of the different methods available for locating elements on a web page using Selenium in Python
  • Best practices for identifying unique and stable locators for web elements

Locating a single element using find_element()

find_element() function is used to locate an element (the first web element) in the webpage that matches the given selection criteria.

Locating multiple elements using find_elements()

find_elements() function is used to locate all the elements the webpage that match the given selection criteria.

Locating elements in hierarchy

The following tutorials help you how to find locate the siblings, parent, or child elements using Selenium

XPath

The following tutorials introduce you to XPath, a very important concept in Selenium for locating the web elements, and different scenarios on how to use XPath to find different types of web elements.

  • What is XPath
  • Writing your first XPath expression
  • XPath syntax
  • Using regular expressions with XPath to match complex patterns.

Form elements

Forms are web elements which are used to take input from the user. The following tutorials cover scenarios of using Selenium to interact with the different types of form elements.

Form interactions

Input Text

Dropdown

  • Selenium - Xpath for dropdown element
  • Selenium - Select a value from dropdown by index
  • Selenium - Select a value from dropdown by value
  • Selenium - Select a random value from dropdown
  • Selenium - Check if dropdown exists
  • Selenium - Iterate through dropdown list

Radio Buttons

Checkboxes

HTML Elements

Any WebElement

Checks

Attributes

Actions

Links

Paragraphs

Headings

  • Selenium - Get all the headings
  • Selenium - Get first heading
  • Selenium - Get heading text

Divs

Images

Action Chains

We can simulate actions from input devices like keyboard, mouse, pen or touch devices, and wheel for scrolling.

  • What is Action Chain in Selenium?
  • Selenium - Click action
  • Selenium - Click and hold action
  • Selenium - Context click action
  • Selenium - Double click action
  • Selenium - Drag and drop action
  • Selenium - Key down action
  • Selenium - Key up action
  • Selenium - Move by offset action
  • Selenium - Move to element action
  • Selenium - Move to element with offset action
  • Selenium - Release action
  • Selenium - Reset action
  • Selenium - Send key action

Click

  • Selenium - Random click

Advanced Python Selenium Techniques

  • Using implicit and explicit waits to handle page loading and element visibility
  • Handling pop-up windows
  • Handling alerts

JavaScript

Problems - Solutions