Selenium WebDriver 3
Practical Guide
Second Edition
End-to-end automation testing for web and mobile browsers with Selenium WebDriver
Unmesh Gundecha
Satya Avasarala
BIRMINGHAM - MUMBAI
Selenium WebDriver 3 Practical GuideSecond Edition
Copyright 2018 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 or its dealers and distributors, will be held liable for any damages caused or alleged to have been 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.
Commissioning Editor: Kunal Chaudhari
Acquisition Editor: Divya Poojari
Content Development Editor: Deepti Thore
Technical Editor: Cymon Pereira
Copy Editor: Safis Editing
Project Coordinator: Kinjal Bari
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Jisha Chirayil
Production Coordinator: Arvindkumar Gupta
First published: January 2014
Second edition: July 2018
Production reference: 1300718
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78899-976-2
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Unmesh Gundecha has over 16 years, experience in Agile software development, test automation, and DevOps methodologies. He is an Agile, open source, and DevOps evangelist with extensive experience in a diverse set of tools and technologies. He has extensive hands-on experience in building sustainable and repeatable test automation solutions for web and mobile platforms, APIs, and CLI apps with continuous integration and delivery pipelines, using best-of-breed open source and commercial tools to do so. He is the author of Selenium Testing Tools Cookbook and Learning Selenium Testing Toolswith Python, both by Packt Publishing.
I would firstly like to thank Rushi Vesmawala, who proposed that I write this book, and Deepti Thore, who coordinated and ensured that I stayed on track. I'd like to thank Pallavi Sharma for providing valuable feedback. I would also like to thank my wife, Punam, and my children Aarav and Ira, for supporting me while I was writing this book and making sure I did things on time. Finally, a big thanks to the Selenium development and user community for building this wonderful tool.
About the reviewer
Pallavi Sharma is a founder of 5 Elements Learning. She has 12 years professional experience. She has worked in varied roles as a product/project manager, in presales team, marketing team, and test automation coach in the software testing domain. Being an avid learner, she also likes to keep herself up to date with the latest trends and technologies. She is a firm believer that there is no shortcut to success.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
This book is about Selenium WebDriver, that is, a browser automation tool used by software developers and QA engineers to test their web application on different web browsers. This book can be used as a reference for your day-to-day usage of WebDriver.
Selenium is a set of tools for automating browsers. It is largely used for testing applications, but its usages are not limited only to testing. It can also be used for screen scraping and automating repetitive tasks in a browser window. Selenium supports automation on all the major browsers, including Firefox, Internet Explorer, Google Chrome, Safari, and Opera. Selenium WebDriver is now a part of W3C standards, and it is supported by major browser vendors.
Who this book is for
If you are a quality assurance/testing professional, test engineer, software developer, or web application developer looking to create automated test suites for your web applications, this is the perfect guide for you! As a prerequisite, this book expects you to have a basic understanding of Java programming although any previous knowledge of WebDriver or Selenium is not needed. By the end of this book, you will have acquired a comprehensive knowledge of WebDriver, which will help you in writing your automation tests.
What this book covers
, Introducing WebDriver and WebElements , will start off with an overview of Selenium and the features. Then, we quickly jump into WebDriver by describing how it perceives a web page. We will also look at what a WebDriver's WebElement is. Then, we talk about locating WebElements on a web page and performing some basic actions on them.
, Working with Browser Drivers , will talk about various implementations of WebDriver, such as FirefoxDriver, IEDriver, and ChromeDriver. We will configure browser options to run tests in headless mode, mobile emulation, and use custom profiles. With WebDriver becoming a W3C specification, all major browser vendors now support WebDriver natively in the browser.
Next page