Selenium 1.0 Testing Tools Beginner's Guide - Burns David - E-Book

Selenium 1.0 Testing Tools Beginner's Guide E-Book

Burns David

0,0
20,56 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

In Detail

Selenium is a suite of tools to automate web application testing across many platforms. A strong understanding of using Selenium will get you developing tests to ensure the quality of your applications.

This book helps you understand and use Selenium to create tests and make sure that what your user expects to do can be done. It will guide you to successfully implement Selenium tests to ensure the quality of your applications.

The Selenium Testing Tools Beginner's guide shows developers and testers how to create automated tests using a browser. You'll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as css, xpath, DOM to find elements on the page.
Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.

A beginner's guide to writing Selenium tests using different aspects of the Framework to give you confidence in your web application

Approach

Written with a fast-paced but friendly and engaging approach, this Packt Beginner's Guide is designed to be placed alongside the computer as your guide and mentor. Step-by-step tutorials are bolstered by explanations of the reasoning behind what you are doing. You will quickly pick up the necessary skills, tips, and tricks for creating successful tests for your web applications with practical examples that help you to learn by experiment and play.

Who this book is for

If you are a Software quality assurance professional, software project manager, or software developer interested in developing automated testing in web based applications, then this book is definitely for you.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 268

Veröffentlichungsjahr: 2010

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Selenium 1.0 Testing Tools Beginner's Guide
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Time for action – heading
What just happened?
Pop quiz – heading
Have a go hero – heading
Reader feedback
Errata
Piracy
Questions
1. Getting Started with Selenium IDE
Important preliminary points
What is Selenium IDE
Time for action – installing Selenium IDE
What just happened?
Selenium IDE
Selenium IDE icons
Important note
Time for action – recording your first test with Selenium IDE
What just happened?
Pop quiz – Selenium IDE
Updating a test to assert items are on the page
Time for action – updating a test to verify items on the page
What just happened?
Have a go hero – using the IDE
Pop quiz
Comments
Time for action – adding Selenium IDE comments
What just happened?
Multiple windows
Time for action – working with multiple windows
What just happened?
Time for action – switching between multiple windows
What just happened?
Selenium tests against AJAX applications
Time for action – working on pages with AJAX
What just happened?
Time for action – working with AJAX applications
What just happened?
Pop quiz – Selenium IDE
Storing information from the page in the test
Time for action – storing elements from the page
What just happened?
Debugging tests
Time for action – debugging tests
What just happened?
Test suites
Time for action – creating test suites
What just happened?
Pop quiz
Saving tests
What you cannot record
Have a go hero – doing more with Selenium IDE
Summary
2. Locators
Important preliminary points
Locating elements by ID
Time for action – finding IDs of elements on the page with Firebug
What just happened?
Pop quiz – using the Find button
Time for action – finding elements by ID
What just happened?
Moving elements on the page
Time for action – finding elements by name
What just happened?
Adding filters to the name
Time for action – finding elements by link text
What just happened?
Time for action – finding elements by accessing the DOM through JavaScript
What just happened?
Pop quiz
Time for action – finding elements by XPath
What just happened?
Using direct XPath in your test
Using XPath to find the nth element of a type
Using element attributes in XPath queries
Doing a partial match on attribute content
Finding an element by the text it contains
Using XPath axis to find elements
Pop quiz – using XPath axis
Have a go hero
CSS selectors
Time for action – finding elements by CSS
What just happened?
Using child nodes to find the element
Using sibling nodes to find the element
Using CSS class attributes in CSS selectors
Using element IDs in CSS selectors
Finding elements by their attributes
Partial matches on attributes
Finding the nth element with CSS
Finding an element by its inner text
Pop quiz – using locators
Have a go hero – working against Google Maps
Summary
3. Pattern Matching
Verifying exact text
Time for action – verifying text
What just happened?
Time for action – using exact: on links
What just happened?
Pop quiz – using exact: in locators
Have a go hero – using exact: in locators
Using globs in our tests
Time for action – using globs in tests
What just happened?
Time for action – using * to find a basic pattern
What just happened?
Time for action – using ? in a glob pattern
What just happened?
Time for action – using character classes in globbing
What just happened?
Pop quiz – using globbing
Have a go hero – using globbing
Using regular expressions
Time for action – using basic regular expressions to check the date
What just happened?
Time for action – using regular expression wildcards
What just happened?
Pop quiz – using regular expressions
Have a go hero – using regular expressions
Summary
4. Using JavaScript
Using JavaScript as our test language
Time for action – using JavaScript to enter text into a field
What just happened?
Time for action – using multiple statements in your JavaScript
What just happened?
Time for action – storing the result of JavaScript in a variable
What just happened?
Pop quiz – using JavaScript
Have a go hero – doing more with JavaScript
Using Selenium variables with JavaScript
Time for action – using Selenium variables with JavaScript
What just happened?
Time for action – JavaScript within a verify or assert
What just happened?
Pop quiz – using Selenium variables in JavaScript
Have a go hero – using Selenium variables in JavaScript
Accessing the browser with JavaScript
Time for action – accessing the page with browserbot
What just happened?
Time for action – verifying a JavaScript evaluation with browserbot
What just happened?
Time for action – using waitForCondition
What just happened?
Pop quiz – accessing the browser with JavaScript
Have a go hero – accessing the browser with JavaScript
Firing events
Time for action – firing a mouseOver event
What just happened?
Time for action – firing an onBlur event in Selenium
What just happened?
Summary
5. User Extensions and Add-ons
Important preliminary points
User extensions
Time for action – installing a user extension
What just happened?
Time for action – using Selenium variables in extensions
What just happened?
Time for action – using locators in extensions
What just happened?
Time for action – using browserbot from within an extension
What just happened?
Time for action – creating new commands to verify or assert
What just happened?
Pop quiz
Have a go hero – doing more with user extensions
Add-ons
Time for action – creating a basic add-on
What just happened?
Pop quiz
Summary
6. First Steps with Selenium RC
Important preliminary points
What is Selenium Remote Control
Setting up Selenium Remote Control
Time for action – setting up Selenium Remote Control
What just happened?
Pop quiz – setting up Selenium Remote Control
Running Selenium IDE tests with Selenium Remote Control
Time for action – running Selenium IDE tests with Selenium Remote Control
What just happened?
Running your Selenium IDE tests in Internet Explorer
Time for action – running our tests in Internet Explorer
What just happened?
Running your Selenium IDE tests in Google Chrome
Time for action – running Selenium IDE tests within Google Chrome
What just happened?
Running your Selenium IDE tests with the User Extensions
Time for action – running Selenium IDE tests with User Extensions
What just happened?
Pop quiz
Have a go hero
Selenium Remote Control arguments
-port
-userExtensions
-firefoxProfileTemplate
Summary
7. Creating Selenium Remote Control Tests
Important preliminary points
Converting Selenium IDE tests to a programming language
Time for action – converting Selenium IDE tests to a language
What just happened?
Pop quiz
Have a go hero – using different browsers
Writing Selenium tests from scratch
Time for action – creating a Selenium instance with JUnit 3
What just happened?
Time for action – creating a Selenium instance with SeleneseTestCase setUp()
What just happened?
Time for action – creating a Selenium instance with JUnit 4
What just happened?
Time for action – creating a Selenium instance with TestNG
What just happened?
Time for action – creating a test from scratch
What just happened?
Pop quiz
Have a go hero
Selenium Remote Control best practises
Time for action – setting up the test
What just happened?
Time for action – moving Selenium steps into Private methods to make tests maintainable
What just happened?
Time for action – using the Page Object Pattern to design tests
What just happened?
Pop quiz
Have a go hero
Setting our tests up in a Continuous Integration server
Time for action – creating an Ant file
What just happened?
Summary
8. Advanced Selenium Techniques
Important preliminary points
Cookie handling
Time for action – getting a cookie off the page
What just happened?
Getting all cookies
Time for action – getting all cookies on the page
What just happened?
Deleting cookies
Time for action – deleting a cookie
What just happened?
Pop quiz – working with cookies
Have a go hero – doing more with cookies
Adding a new location strategy
Time for action – adding a new location strategy
What just happened?
Capturing network traffic
Time for action – capturing network traffic
What just happened?
Capturing screenshots
captureScreenshot call
Time for action – capturing screenshots
What just happened?
Time for action – capturing a screenshot to string
What just happened?
Capturing the entire page
Time for action – capturing the entire page as a screenshot
What just happened?
Time for action – capture entire page as a screenshot changing background colour
What just happened?
Time for action – capturing the entire page screenshot to a string
What just happened?
Pop quiz
Have a go hero
Capturing video
Time for action – setting up the environment to capture video
What just happened?
Time for action – recording a video in a test
What just happened?
Pop quiz
Have a go hero
Summary
9. Getting Started with Selenium Grid
Important preliminary points
Understanding Selenium Grid
Checking that we have the necessary items for Selenium Grid
Time for action – doing a sanity check on Selenium Grid
What just happened?
Selenium Grid Hub
Time for action – launching the hub
What just happened?
Adding instances to the hub
Time for action – adding a remote control with the defaults
What just happened?
Adding Selenium Remote Controls for different machines
Time for action – adding Selenium Remote Controls for different machines
What just happened?
Adding Selenium Remote Control for different browsers
Time for action – setting the Environment when starting Selenium Remote Control
What just happened?
Updating the Selenium Grid Configuration
Time for action – adding new items to the Grid Configuration
What just happened?
Pop quiz – doing the thing
Running tests against the Grid
Time for action – writing tests against the grid
What just happened?
Summary
10. Running Selenium Tests in Parallel
Important preliminary points
Setting up TestNG
Time for action – starting to create the test suite
What just happened?
Parameters in the configuration file
Time for action – creating a test node in the TestNG configuration
What just happened?
Getting our tests to use parameters
Time for action – adding the parameters to our tests
What just happened?
Parallel testing
Time for action – getting our tests running in parallel
What just happened?
Pop quiz – running tests in parallel
Have a go hero – doing more with the thing
Tips and tricks for running tests in parallel
Independent tests
Cleaning up tests
Username and password
Firefox profiles
Summary
11. Getting Started with Selenium 2
Important preliminary points
Why Selenium and WebDriver are being merged
So what if a new browser is released?
How will the browser interaction change?
Converting Selenium 1 tests to Selenium 2
Time for action – converting tests to Selenium 2 using WebDriverBackedSelenium
What just happened?
Pop quiz
Starting a Selenium 2 browser instance
Time for action – instantiating new browsers and closing them
What just happened?
Pop quiz
Have a go hero
Accessing elements on the page and interacting with them
Time for action – finding a link and clicking it
What just happened?
Finding elements with XPath
Time for action – finding an element with XPath
What just happened?
Finding multiple elements
Time for action – finding multiple elements on the page
What just happened?
Typing into input fields
Time for action – typing into a text box
What just happened?
Real-life interaction
Time for action – working with hidden elements throws errors
What just happened?
Pop quiz
Have a go hero
Working with JavaScript in Selenium 2
Time for action – using JavaScript in Selenium 2
What just happened?
Returning something from your JavaScript to your test
Time for action – returning from executing JavaScript
What just happened?
Pop quiz
Have a go hero
Summary
A. Pop Quiz Answers
Chapter 1 – Getting Started with Selenium IDE
Chapter 2 – Locators
Chapter 3 – Pattern Matching
Chapter 4 – Using JavaScript
Chapter 5 – User Extensions and Add-ons
Chapter 6 – First Steps with Selenium RC
Chapter 7 – Creating Selenium Remote Control Tests
Chapter 8 – Advanced Selenium Techniques
Chapter 9 – Getting Started with Selenium Grid
Chapter 10 – Running Selenium Tests in Parallel
Chapter 11 – Getting started with Selenium 2
Index

Selenium 1.0 Testing Tools Beginner's Guide

Selenium 1.0 Testing Tools Beginner's Guide

Copyright © 2010 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: November 2010

Production Reference: 1171110

Published by Packt Publishing Ltd.

32 Lincoln Road

Olton

Birmingham, B27 6PA, UK.

ISBN 978-1-849510-26-4

www.packtpub.com

Cover Image by Duraid Fatouhi (<[email protected]>)

Credits

Author

David Burns

Reviewers

Tarun Kumar Bhadauria

Sameer Borate

Acquisition Editor

Usha Iyer

Development Editors

Neha Mallik

Rakesh Shejwal

Technical Editor

Aaron Rosario

Copy Editor

Lakshmi Menon

Indexer

Tejal Daruwale

Editorial Team Leader

Aanchal Kumar

Project Team Leader

Priya Mukherji

Project Coordinator

Zainab Bagasrawala

Proofreader

Mario Cecere

Graphics

Nilesh Mohite

Geetanjali Sawant

Production Coordinator

Melwyn D'sa

Cover Work

Melwyn D'sa

About the Author

David Burns is a Senior Developer in Test having worked with Selenium for quite a few years. David is a Selenium Core Committer, so he knows and understands what users and developers want from the framework.

I would like to thank my wife for supporting me while I was writing my book and making sure I did things on time.

I would also like to thank the other Selenium Committers for answering my questions and cheering me on to finish the book.

About the Reviewers

Tarun Kumar Bhadauria is an Electronics Engineer and hails from Gwalior. He has been involved with software testing for over five years. He spent most of his career with QA practices for the Indian division of CIBER. He is currently associated with Tavant Technologies Bangalore. He has worked on a gamut of testing fields that encompasses Manual Testing, Performance Testing and Functional Test Automation using both commercial and open source tools. His primary inclination has been towards functional test automation using Selenium.

Tarun has been key contributor to Official Selenium Documentation and was recognized as co-author for Selenium documentation release 1.0 by Selenium Head Quarters.

His spare moments are spent in exercise and blogging.

Sameer Borate is an independent web developer based in Pune, India. He has been developing web applications using PHP and MySQL since 2000, when PHP was just a blip on the web radar, and now spends most of his time working with XHTML, PHP, XML, MySQL, and JavaScript. For the last few years he has been helping small companies design web application architectures for their clients. In his free time he likes to peruse non-fiction books.

He regularly blogs about web development at www.codediesel.com.

I would like to thank my wife for her support in all of my different endeavors, even at times when they were impractical. Also thanks to Packt Publishing for providing me with this great learning opportunity. And finally thanks to the Open Source community for making all of this possible.

Preface

The Selenium 1.0 Testing Tools Beginner's guide shows developers and testers how to create automated tests using a browser. You'll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as CSS, XPath, and DOM to find elements on the page.

Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.

What this book covers

Chapter 1, Getting started with Selenium IDE: In this chapter we will have a look at installing Selenium IDE and recording our first tests. We will see what is needed to work against AJAX applications.

Chapter 2, Locators: In this chapter we will see how we can find elements on the page to be used in our tests. We will use XPath, CSS, Link Text, and ID to find elements on the page so that we can interact with them.

Chapter 3, Pattern Matching: In this chapter we will have a look at using regular expressions, globbing, and then using the exact text to find elements or test text on the page.

Chapter 4, Using JavaScript: Sometimes it is good to inject JavaScript into the page to improve its testability. There are frameworks that people are using within web applications that don't allow Selenium direct access, so this chapter will explain what we need to do in such cases.

Chapter 5, User-Extensions and Add-ons: This chapter will show us how we can create our own Selenium commands that can be used within Selenium IDE. We will also have a look at creating Add-ons for Selenium IDE to expand the functionality of the Selenium IDE.

Chapter 6, First Steps with Selenium RC: In this chapter we will see how we can set up Selenium Remote Control. We can start running our Selenium IDE tests against browsers that we haven't used yet.

Chapter 7, Creating Selenium Remote Control Tests: In the previous chapter we had a look at getting our tests running against different browsers. This chapter goes one step further so we can convert our IDE tests to use a programming language. We also have a look at some good practices and how to integrate with a CI Server.

Chapter 8, Advanced Selenium Techniques: In this chapter we will have a look at how we can do cookie handling within our tests. We will also have a look at how we can create our own locator strategies for find elements on the page. We then move to capturing network traffic between the browser and the web server. We finish off capturing screenshots and video.

Chapter 9, Getting started with Selenium Grid: This chapter shows us how we can set up our Selenium Grid. Selenium Grid is a very good infrastructural tool for managing Selenium Remote Control instances so we run tests against it.

Chapter 10, Running Selenium Tests in parallel: Selenium tests generally run sequentially. This chapter demonstrates how we can use TestNG to run our tests in parallel to take full advantage of Selenium Grid.

Chapter 11, Getting started with Selenium 2: This chapter will help explain the merger of Selenium and WebDriver to create Selenium 2. It explains how the interaction with the browser has changed and how we can convert our Selenium 1 tests to Selenium 2 in order to take advantage of these changes. Finally, we have a look at how executing JavaScript has changed.

What you need for this book

Mozilla FirefoxGoogle ChromeInternet ExplorerIntellij IDEAFirebugFirefinderSelenium IDESelenium Remote ControlSelenium GridUbuntu Linux

Who this book is for

If you are a software quality assurance professional, software project manager, or software developer interested in developing automated testing in web-based applications, then this book is definitely for you.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

Action 1Action 2Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz – heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero – heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

@Before public void someMethodName(){ selenium.doSomething(); selenium.doSomethingElse(); }

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

@Before public void someMethodName(){ selenium.doSomething(); selenium.doSomethingElse(); }

Any command-line input or output is written as follows:

–jar selenium-server-standalone.jar

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Getting Started with Selenium IDE

Test automation has grown in popularity over the years because teams do not have the time or money to invest in large test teams to make sure that applications work as they are expected to. Developers also want to make sure that the code they have created works as they expect it to.

Developers use a multitude of different testing frameworks to test different aspects of the system. Selenium is one of the most well-known testing frameworks in the world that is in use. It is an open source project that allows testers and developers alike to develop functional tests to drive the browser. It can be used to record workflows so that developers can prevent future regressions of code. Selenium can work on any browser that supports JavaScript since Selenium has been built using JavaScript.

In this chapter, we will cover the following topics:

What is Selenium IDERecording our first testUpdating tests to work with AJAX sitesUsing variables in our testsDebugging testsSaving tests to be used laterCreating and saving test suites

So let's get on with it...

Important preliminary points

Before we start working through this chapter you need to make sure that Mozilla Firefox is installed on your machine. If you do not have Mozilla Firefox installed, you will need to download it from http://www.getfirefox.com/.

What is Selenium IDE

Selenium IDE is a Firefox add-on developed originally by Shinya Kasatani as a way to use the original Selenium Core without having to copy Selenium Core onto the server. It has been developed using JavaScript so that it can interact with DOM (Document Object Model) using native JavaScript calls.

Selenium IDE was developed to allow testers and developers to record their actions as they follow the workflow that they need to test.

Time for action – installing Selenium IDE

Now that we understand what Selenium IDE is, it is a good time to install the Selenium IDE. By the end of these steps, you will have successfully installed the Selenium IDE on your computer.

Go to http://seleniumhq.org/download/.Click on the download link for Selenium IDE. You may get a message saying Firefox prevented this site (seleniumhq.org) from asking you to install software on your computer. If you do, click on the Allow button.A pop up will appear, as seen in the next screenshot:Once the countdown has finished, the Install button will become active and you can click on it. This will now install the Selenium IDE as a Firefox add-on.Once the installation process is complete, it will ask you to restart Firefox. Click on the Restart button. Firefox will close and then reopen. If you have anything open in another browser, it might be worth saving your work as Firefox will try to go back to its original state, but this cannot be guaranteed.Once the installation is complete, the Add-ons window will show the Selenium IDE and its current version.

What just happened?

You have successfully installed Selenium IDE, and we can now start thinking about writing our first test.

Selenium IDE

Selenium IDE has been installed, so let's take some time to familiarize ourselves with it. This will give us the foundation that we can use in later chapters.

Open up Selenium IDE by going through the Tools menu in Mozilla Firefox. The steps are Tools | Selenium IDE. The window that will appear should be similar to the next screenshot.

Selenium IDE icons

Starting from the top, I will explain what each of the items is:

Base URL—This is the URL that the test will start. All open commands will be relative to the Base URL unless a full path is inserted in the open command.Speed Slider—This is the slider under the Fast Slow labels on the screen.—Run all the tests in the IDE. —Run a single test in the IDE. —Pause a test that is currently running. —Step through the test once it has paused. —This is the record button. It will be engaged when the test is recording. —This allows you to run your tests using the Selenium Core TestRunner and not Selenium IDE. When pressed, it will open up Firefox to the TestRunner and it looks similar to the next screenshot: The Selenese Command select box has a list of all the commands that are needed to create a test. You can type into it to use the auto complete functionality or use it as a dropdown.Target textbox allows you to input the location of the element that you want to work against.The Find button, once the target box is populated, can be clicked on to highlight the element on the page.Value textbox is where you place the value that needs to change. For example, if you want your test to type in an input box on the web page, you would put what you want it to type in the value box.The Test table will keep track of all of your commands, targets, and values. It has been structured this way because the original version of Selenium was styled on FIT tests. The tests were originally designed to be run from HTML files and the IDE keeps this idea for its tests. If you click on the Source tab, you will be able to see the HTML that will store the test. Each of the rows will look like:
<tr> <td>open</td> <td>/chapter1</td> <td></td> </tr>
The area below the Value textbox will show the Selenium log while the tests are running. If an item fails, then it will have an [error] entry. This area will also show help on Selenium commands when you are working in the Command select box. This can be extremely useful when typing commands into the Selenium IDE instead of using the record feature.

Important note

Now that we have installed Selenium IDE and understood what it is, we can think about working through our first tests. There are a few things that you need to consider when creating your first test. These rules apply to any form of test automation but need to be adhered to especially when creating tests against a User Interface.

Tests should always have a known starting point. In the context of Selenium, this could mean opening a certain page to start a workflow.Tests should not have to rely on any other tests to run. If a test is going to add something, do not have a separate test to delete it. This is to ensure that if something goes wrong in one test, it will not mean you have a lot of unnecessary failures to check.Tests should only test one thing at a time.Tests should clean up after themselves.

These rules, like most rules, can be broken. However, breaking them can mean that you may run into issues later on, and when you have hundreds or even thousands of tests, these small issues can mean that large parts of a test suite are red.

With these rules in mind, let us create our first Selenium IDE test.

Time for action – recording your first test with Selenium IDE

We are going to record our first test using Selenium IDE. To start recording the tests, we will need to start Mozilla Firefox. Once it has been loaded, you will need to start the Selenium IDE. You will find it under the Tools menu in Mozilla Firefox. Note that the record button is engaged when you first load the IDE.

To start recording your tests:

Change the Base URL