Book description
Over 90 recipes to help you build and run automated tests for your web applications with Selenium WebDriver
About This Book
- Learn to leverage the power of Selenium WebDriver with simple examples that illustrate real-world problems and their workarounds
- Explains the testing of mobile applications with Appium for mobile platforms such as iOS and Android
- A pragmatic manual with engaging recipes and attractive screenshots to test your web applications efficiently
Who This Book Is For
This book is intended for software quality assurance/testing professionals, software project managers, or software developers with prior experience in using Selenium and Java to test web-based applications. This books also provides examples for C#, Python and Ruby users.
What You Will Learn
- Understand how the locators work and use various locator methods to build reliable tests
- Build reliable and maintainable tests with the Selenium WebDriver API
- Use the PageFactory pattern to build a robust and easy to maintain test framework
- Build data-driven tests and extend Selenium API to implement custom steps and checks
- Integrate and use ATDD/BDD tools such as Cucumber, SpecFlow, Capybara, and Behave with the Selenium WebDriver API
- Set up iPhone/iPad and Android simulators and devices to test your mobile web application with Appium
- Set up Selenium Grid for faster and parallel running of tests, increasing test coverage and reducing test execution time for cross-browser testing
- Build extended Selenium WebDriver tests for additional coverage
In Detail
This book is an incremental guide that will help you learn and use the advanced features of the Selenium toolset including the WebDriver API in various situations to build a reliable test automation. You start off by setting up the test development environment and gain tips on the advanced locater strategy and the effective use of the Selenium WebDriver API.
After that, the use of design patterns such as data - driven tests and PageFactory are demonstrated. You will then be familiarised with extending Selenium WebDriver API by implementing custom tasks and setting up your own distributed environment to run tests in parallel for cross-browser testing.
Finally, we give you some tips on integrating Selenium WebDriver with other popular tools and testing mobile applications. By the end of this book, you will have learned enough to solve complex testing issues on your own.
Style and approach
This recipe-based guide covers real-life scenarios of testing your web apps with Selenium. Each recipe begins with a short introduction and key concepts along with illustrated examples of use cases, and ends with detailed but informative descriptions of the inner workings of the example.
Table of contents
-
Selenium Testing Tools Cookbook Second Edition
- Table of Contents
- Selenium Testing Tools Cookbook Second Edition
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
-
1. Getting Started
- Introduction
- Configuring the Selenium WebDriver test development environment for Java with Eclipse and Maven
- Using Ant for the Selenium WebDriver test execution
- Configuring Microsoft Visual Studio for Selenium WebDriver test development
- Configuring Selenium WebDriver for Python and Ruby
- Setting up Internet Explorer Driver Server
- Setting up ChromeDriver for Google Chrome
- Setting up Microsoft WebDriver for Microsoft Edge
-
2. Finding Elements
- Introduction
- Using browser tools for inspecting elements and page structure
- Finding an element using the findElement method
- Finding elements using the findElements method
- Finding links
- Finding elements by tag name
-
Finding elements using XPath
- Selecting nodes
-
How to do it...
- Finding elements with an absolute path
- Finding elements with a relative path
- Finding elements using predicates
- Finding elements using attributes values with XPath
- Finding elements using attributes with XPath
- Matching any attribute using a value
- Selecting unknown nodes
- Selecting several paths
- Locating elements with XPath axes
- How it works...
-
Finding elements using CSS selectors
-
How to do it...
- Finding elements with an absolute path
- Finding elements with a relative path
- Finding elements using the Class selector
- Finding elements using the ID selector
- Finding elements using the attributes selector
- Finding elements using the attributes name selector
- Selecting several paths
- Performing a partial match on attribute values
- How it works...
- See also
-
How to do it...
- Locating elements using text
- Finding elements using advanced CSS selectors
- Using jQuery selectors
-
3. Working with Elements
- Introduction
- Automating textboxes, text areas, and buttons
- Checking an element's text
- Checking an element's attribute and CSS values
- Automating dropdowns and lists
- Checking options in the Select element
- Checking selected options in dropdowns and lists
- Automating radio buttons and radio groups
- Automating checkboxes
- Working with WebTables
-
4. Working with Selenium API
- Introduction
- Checking an element's presence
- Checking an element's state
- Using Advanced User Interactions API for mouse and keyboard events
- Performing double-click on an element
- Performing drag-and-drop operations
- Working with context menus
- Executing the JavaScript code
- Capturing screenshots with Selenium WebDriver
- Maximizing the browser window
- Handling session cookies
- Working with browser navigation
- Working with WebDriver events
- 5. Synchronizing Tests
- 6. Working with Alerts, Frames, and Windows
-
7. Data-Driven Testing
- Introduction
- Creating a data-driven test using JUnit
- Creating a data-driven test using TestNG
- Reading test data from a CSV file using JUnit
- Reading test data from an Excel file using JUnit and Apache POI
- Creating a data-driven test in NUnit
- Creating a data-driven test in MSTEST
- Creating a data-driven test in Ruby using Roo
- Creating a data-driven test in Python using DDT
-
8. Using the Page Object Model
- Introduction
- Using the PageFactory class for exposing the elements on a page
- Using the PageFactory class for exposing an operation on a page
- Using the LoadableComponent class
- Implementing nested Page Object instances
- Implementing the Page Object model in .NET
- Implementing the Page Object model in Python
- Implementing the Page Object model in Ruby using the page-object gem
-
9. Extending Selenium
- Introduction
- Creating an extension class for web tables
- Creating an extension for the jQueryUI tab widget
- Implementing an extension for the WebElement object to set the element attribute values
- Implementing an extension for the WebElement object to highlight elements
- Creating an object map for Selenium tests
- Capturing screenshots of elements in the Selenium WebDriver
- Comparing images in Selenium
- Measuring performance with the Navigation Timing API
- 10. Testing HTML5 Web Applications
- 11. Behavior-Driven Development
-
12. Integration with Other Tools
- Introduction
- Configuring Jenkins for continuous integration
- Using Jenkins and Maven for Selenium WebDriver test execution in continuous integration
- Using Ant for Selenium WebDriver test execution
- Using Jenkins and Ant for Selenium WebDriver test execution in continuous integration
- Automating a non-web UI in Selenium WebDriver with AutoIt
- Automating a non-web UI in Selenium WebDriver with Sikuli
-
13. Cross-Browser Testing
- Introduction
- Setting up Selenium Grid Server for parallel execution
- Adding nodes to Selenium Grid for cross-browser testing
- Creating and executing the Selenium script in parallel with TestNG
- Creating and executing the Selenium script in parallel with Python
- Using Cloud tools for cross-browser testing running tests in the Cloud
- Running tests in headless mode with PhantomJS
- 14. Testing Applications on Mobile Browsers
- Index
Product information
- Title: Selenium Testing Tools Cookbook - Second Edition
- Author(s):
- Release date: October 2015
- Publisher(s): Packt Publishing
- ISBN: 9781784392512
You might also like
book
Selenium Testing Tools Cookbook
Unlock the full potential of Selenium WebDriver to test your web applications in a wide range …
book
Learning Selenium Testing Tools - Third Edition
Leverage the power of Selenium to build your own real-time test cases from scratch In Detail …
book
Selenium WebDriver Recipes in C#, Second Edition
Solve your Selenium WebDriver problems with this quick guide to automated testing of web applications with …
book
Selenium WebDriver 3 Practical Guide - Second Edition
Real-world examples of cross-browser, mobile, and data-driven testing with all the latest features of Selenium WebDriver …