Beginning Selenium WebDriver Testing in Python
This course introduces Python users to Selenium WebDriver. It will help users with basic programming knowledge to start code-testing. This course will help users cut down on their time spent on testing code written in Python.
Get started with code testing using Selenium WebDriver. This course is an ideal starter kit for those of you who wish to start using Selenium WebDriver for testing, and for users with basic programming knowledge who are more interested in skilling up with Selenium WebDriver as their testing tool of choice. In this course, you will start by learning the benefits of Selenium WebDriver for testing. You will then start practicing the basics. Next, you will explore the biggest strength of Selenium: integrating your test instances with the browser of your choice. You will then actually test an authentication system in a sequential manner by following each of the required steps.
By the end of the course, you will be able to provide your customers and clients with better quality code in less time, enhancing customer satisfaction!
About the Author
Andy Craze is a full-stack software engineer with over 7 years’ experience developing highly-scalable web applications. He has used Selenium WebDriver to test numerous different products, ranging from large-scale enterprise systems and multi-tenant ecommerce platforms to simple static sites and documentation software. Andy works in Java and Python but has experience in a broad range of languages and technologies, including Haskell. His code has been used by Intel, Discogs, and Arizona State University
Getting Started with Selenium WebDriver in Python
This video will provide entire overview of the course.
In this video, we will discuss why automated tests are better than manual testing, by taking a look at various benefits of using test automation and the different ways it can impact your software.
• Understand why automated testing is useful
• Save time and money with automated tests
• Improve your software’s quality with test automation
This video will provide an overview of the Selenium test suite and focus primarily on WebDriver.
• Go through a brief overview of the Selenium test suite
• Learn about automated testing with WebDriver
• Know the limitations of Selenium WebDriver
This video will show you how to install WebDriver on your local machine.
• Install Selenium 3
• Install ChromeDriver
• Go through Simple Browser Automation
This video will show how Selenium works underneath the hood. We will take a look at how we can use WebDriver to automate a browser’s native functionality.
• Understand the WebDriver Architecture
• Use language bindings, drivers and browsers
• Automate a browser using WebDriver
Web applications can often behave differently across browsers. Selenium offers a way to test against a number of specific browsers. This video will show you how to use them.
• Automate different browsers
• Explore the available drivers
• Configure a driver
In this video, we will see how can we make a browser visit a web page. This can be done quite easily a simple WebDriver command.
• Retrieve a web page
• Use WebDriver’s get method
• Automate a browser to visit a given URL
Let’s write automation code that will let us perform basic actions on a web page. In this video, we will get our first look at WebDriver’s locator actions.
• Perform actions on a web page using Python
• Visit the Google home page with Python
• Automate a Google search using Python
Locating Web Elements in the Browser
There are numerous different ways to locate elements on a web page, but which is the best method? We will show examples of how and when to use various locator types to find elements on a web page.
• Implement random Wikipedia search
• Create some Python locators
• Locate web elements using our locator classes
We can make our code more robust by creating locators using some of WebDriver’s classes.
• We can locate various web elements using various methods
• Use CSS Selectors, Name, Tag Name and Link Text Locators
• Implement locators for our Wikipedia example
Some web elements are nestled deep in the HTML page structure. WebDriver allows us to target these elements using XML paths aka XPaths.
• Locating hard-to-reach elements
• Using XPath tools
• Creating an XPath locator
Testing an Authentication System
What is a real-life system that needs testing? Let's start with a common example: authentication. We all know how logging in to a site works. Let’s use that knowledge and test a basic authentication system.
• Test a successful login
• Test a login failure
• Discover repeated steps for both tests
We have a high-level outline of how our authentication system should work. How can we describe this behavior in our code? We will show you how to test the system using Python and WebDriver.
• Run an authentication server
• Manually test how the application behaves
• Create a rough outline of testing steps in Python
There are a number of important web elements that need to be targeted in our automated tests. We will inspect the page and figure out how to target all of the essential elements.
• Inspect the HTML markup for the authentication system
• Discover how to target various key web elements
• Create locators for each web element in Python
We have all our test steps automated and all web elements located. Now, how do we clean up our tests so that we can run them easily? We will show you how to use a simple Python framework that makes testing very simple.
• Automate our tests using a Python framework
• Using the unit test framework
• Update automation code to use the Python unit test framework
How can we run our tests in a repeatable way? We will discuss the various parts that make up a test suite.
• Understanding a test framework
• Test fixtures, cases and suites
• Using a test runner
Wrapping Up with Next Steps
Now that we have a working example, we will explore using a further level of abstraction by using Page Objects. This will help us create our own test framework for our authentication system.
• Basic overview of the Page Object pattern
• Create a Page Object for the BrowserDriver
• Create a Page Object for the LoginPage
Now that we have seen how to test a small application, we will discuss how you can continue your journey of test automation using Selenium WebDriver.
• Quick review of Selenium WebDriver
• Integrate with various Python test frameworks
• Run headless tests using PhantomJS
We will wrap up everything we learned in the course with a quick overview of Selenium and talk about what to work on next.
• Think how to model manual tests in Python code
• Automate tests using WebDriver
• Practice using real-world examples