35,99 €
Take a deep dive into building data-driven test frameworks using Selenium WebDriver
The Selenium WebDriver 3.x Technology is an open source API available to test both Browser and Mobile applications. It is completely platform independent in that tests built for one browser or mobile device, will also work on all other browsers and mobile devices. Selenium supports all major development languages which allow it to be tied directly into the technology used to develop the applications. This guide will provide a step-by-step approach to designing and building a data-driven test framework using Selenium WebDriver, Java, and TestNG.
The book starts off by introducing users to the Selenium Page Object Design Patterns and D.R.Y Approaches to Software Development. In doing so, it covers designing and building a Selenium WebDriver framework that supports both Browser and Mobile Devices. It will lead the user through a journey of architecting their own framework with a scalable driver class, Java utility classes, JSON Data Provider, Data-Driven Test Classes, and support for third party tools and plugins.
Users will learn how to design and build a Selenium Grid from scratch to allow the framework to scale and support different browsers, mobile devices, versions, and platforms, and how they can leverage third party grids in the Cloud like SauceLabs.
Other topics covered include designing abstract base and sub-classes, inheritance, dual-driver support, parallel testing, testing multi-branded applications, best practices for using locators, and data encapsulation.
Finally, you will be presented with a sample fully-functional framework to get them up and running with the Selenium WebDriver for browser testing.
By the end of the book, you will be able to design your own automation testing framework and perform data-driven testing with Selenium WebDriver.
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 book is geared towards the quality assurance and development professionals responsible for designing and building enterprise-based testing frameworks.The user should have a working knowledge of the Java, TestNG, and Selenium technologies
Carl Cocchiaro has a Bachelors Degree in Business and 30 years experience in the software engineering field, designing and building test frameworks for Desktop, Browser, and Mobile applications. He is an expert in the Selenium WebDriver/TestNG Java-based Technologies, Certified SilkTest Engineer, and has architected UI and RESTful API automation frameworks for 25 major corporations. Carl is currently Software Architect, Quality Engineering at RSA/Dell Technologies, located in Boston, MA USA.Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 319
Veröffentlichungsjahr: 2018
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 ChaudhariAcquisition Editor: Denim PintoContent Development Editor: Jason PereiraTechnical Editor: Prajakta MhatreCopy Editor: Safis EditingProject Coordinator: Sheejal ShahProofreader: Safis EditingIndexer: Rekha NairProduction Coordinator: Nilesh Mohite
First published: January 2018 Production reference: 1180118
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78847-357-6
www.packtpub.com
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.
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
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 [email protected] 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.
Carl Cocchiaro has a bachelor's degree in business and over 30 years of experience in the software engineering field, designing and building test frameworks for desktop, browser, and mobile applications. He is an expert in the Selenium WebDriver/TestNG Java-based technologies, certified SilkTest engineer, and has architected UI and RESTful API automation frameworks for 25 major corporations.
Carl is currently a Software Architect, Quality Engineering at RSA/Dell technologies, located in Boston, MA USA.
Pinakin Chaubal is a BE (computer science) from Dharamsinh Desai Institute of Technology (affiliated to Gujarat University). He is a PMP and HP0-M47 QTP 11 certified professional and is also certified at ISTQB foundation level. He carries over 17 years of experience in the IT world and has been working with companies like Patni, Accenture, L&T Infotech, and many more. He is the creator of the Automation Geek channel on Youtube that teaches about PMP, ISTQB, Selenium WebDriver (integration with Jenkins), Page Object Model using Cucumber and JavaScript (including ES6).
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
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Building a Scalable Selenium Test Driver Class for Web and Mobile Applications
Introduction
Data-driven testing
Selenium Page Object Model
DRY
What you will learn
The singleton driver class
Requirements
The class signature
Class variables
JavaDoc
Parameters
Class methods
Using preferences to support browsers and platforms
Browser preferences
Platforms
Using preferences to support mobile device simulators, emulators, and real devices
iOS preferences
Android preferences
Multithreading support for parallel and distributed testing
Passing optional arguments and parameters to the driver
varargs
The parameter for setDriver
JVM argument – -Dswitch
Parameter processing methods
Selenium Grid Architecture support using the RemoteWebDriver and AppiumDriver classes
Third-party grid architecture support including the Sauce Labs Test Cloud
Using property files to select browsers, devices, versions, platforms, languages, and many more
Summary
Selenium Framework Utility Classes
Introduction
Global variables
Synchronization utility classes
Selenium synchronization classes
The ExpectedConditions class
WebDriverWait/FluentWait classes
Custom synchronization methods
The JavascriptExecutor class
The TestNG Listener class
Building the test listener class
Logging the results to the console or log file
Including the test runner in the test class or suite
File I/O class
Property files
Lookup table files
CSV files
Log files
The image capture class
The capture screen method
The capture image method
The compare image method
The reporter class
The JavaMail class
Summary
Best Practices for Building Selenium Page Object Classes
Introduction
What you will learn
Best practices for naming conventions, comments, and folder structures
Naming conventions
Comments
Folder names and structures
Designing and building the abstract base classes for the AUT
The abstract class
Abstract methods
Common locators
Common methods
Wrap up on base classes
Designing and building subclasses for feature-specific pages using inheritance techniques
Encapsulation and using getter/setter methods to retrieve objects from the page object classes
Exception handling and synchronization in page object class methods
Implicit exception handling
TestNG difference viewer
Explicit exception handling
Try...catch exception handling
Synchronizing methods
Table classes
Summary
Defining WebDriver and AppiumDriver Page Object Elements
Introduction
Inspecting page elements on browser applications
Types of locators
Inheriting WebElements
Inspecting WebElements
Third-party plugins/tools
Inspection of page elements on mobile applications
Appium inspector
Inspecting mobile elements
Standards for using static locators
Rules for using standard locators
Simple locators
CSS locators
XPath query locators
Referencing static elements in methods
Retrieving static elements from other classes
Standards for using dynamic locators
Single attribute XPath versus CSS locators
WebElements
MobileElements
Multiple attribute XPath versus CSS locators
Using dynamic locators in methods
Summary
Building a JSON Data Provider
Introduction
What you will learn
The TestNG Data Provider class
The @DataProvider annotation
The @Test annotation
Extracting JSON data into Java objects
Filtering test data
Filtering include and exclude patterns
JSON Data File formats
The JSONObject class
Summary
Developing Data-Driven Test Classes
Introduction
Annotating test class methods using TestNG
TestNG annotations
@Test
TestNG setup/teardown methods
Setup methods
@BeforeSuite, @BeforeTest, @BeforeGroups, @BeforeClass, and @BeforeMethod
Teardown methods
@AfterSuite, @AfterTest, @AfterGroups, @AfterClass, and @AfterMethod
Order of precedence
Naming conventions for test methods
Test classes and data files
Test methods
Test parameters
Test groups
Test setup/teardown methods
Using the TestNG DataProvider
Calling page object methods in test classes
Exception handling in test classes
Test methods
The setup/teardown methods
The ITestResult class
Test listener/reporter classes
Designing base setup classes
TestNG suite file structure
Suite section: <suite>
Groups section: <groups>
Listeners section: <listeners>
Test section: <test>
Suite parameters
@Parameters
Summary
Encapsulating Data in Data-Driven Testing
Introduction
Casting JSON data to Java objects
JSON object
Sequential numbering of row IDs in the data file
Using Java object getter/setter methods
Passing data to page object methods
Building in positive, negative, boundary, and limit testing
Negative testing
Confirmation and exception property files
Property files
Lookup method in DataProvider
JSON data file data
Converting confirmation/error code on the fly
Property files and parsing test data on the fly
Environment property files
System properties
Initializing property file data
Global variables versus dynamic data
Processing JVM args
Retrieving JSON data outside of test methods
Supporting multibranded applications
Multilocators
Conditional code
Runtime flags
Multiple driver support
Dual WebDriver testing
Dual WebDriver and AppiumDriver testing
Parallel testing
Suite XML file
Parallel properties method
Common setup
Summary
Designing a Selenium Grid
Introduction
Virtual grids
Grid structure
Single browser nodes
Multibrowser nodes
Single mobile device nodes
Multimobile/browser nodes
Selenium driver class – WebDriver versus RemoteWebDriver
The setDriver method for browser
The setDriver method for mobile
Overloaded setDriver method for browser
Switching from local to remote driver
Suite parameters
JVM argument
Default global variables
Processing runtime parameters
Selenium standalone server and client drivers
Local use of drivers
Remote use of drivers
Selenium standalone server and browser driver command-line options
Selenium hub
Selenium hub JSON configuration file
Selenium nodes
Selenium node JSON configuration file
Appium server and mobile simulator/emulator command-line options
Appium nodes
Appium node JSON configuration file
Selenium Grid console
Directing traffic to Selenium nodes
Multiple nodes of the same platform and version
Directing traffic using desired capabilities
Maintenance of the Selenium Grid
Summary
Third-Party Tools and Plugins
Introduction
IntelliJ IDEA Selenium plugin
Sample project files
Generating element locators
Wrap-up on Selenium Plugin
TestNG results in IntelliJ and Jenkins
IntelliJ TestNG results
Jenkins TestNG results
HTML Publisher Plugin
Installation
BrowserMob Proxy Plugin
Getting started
ExtentReports Reporter API class
ExtentHTMLReporter
Dashboard page
Categories page
Tests page
Code sample
Sauce Labs Test Cloud services
Sauce Labs Test Cloud features
Browser and mobile platforms
Driver code changes
Dashboard
SauceConnect tunnel
TestObject Real Device Cloud
Jenkins plugin
Advantages and disadvantages of using in-house versus third-party grids
Summary
Working Selenium WebDriver Framework Samples
Introduction
Selenium driver and DataProvider classes
CreateDriver.java
JSONDataProvider class
Selenium utility classes
BrowserUtils.java
Global_VARS.java
TestNG_ConsoleRunner.java
selenium.properties
ExtentReports classes
ExtentTestNGIReporterListener.java
extent-config.xml
Browser page object base and subclasses
PassionTeaCoBasePO.java
PassionTeaCoWelcomePO.java
Browser test class and data files
PassionTeaCoTest.java
PassionTeaCo.json
Browser Suite XML and Maven Pom XML files
PassionTeaCo.xml
pom.xml file
Summary
The Selenium WebDriver API is based on the JSON wire over the HTTP protocol. It is currently the industry gold standard for test automation. Selenium Framework design in data-driven testing is a comprehensive approach to designing data-driven test frameworks using the Selenium 3 WebDriver API, Java bindings, and TestNG technologies. This book will guide users through a series of design paradigms in building the Selenium WebDriver Framework for both browser and mobile applications. The user will be able to take sample framework code and apply it directly to their own application framework.
The technology discussed in this book is based on the Selenium 3 WebDriver API, Java bindings, and TestNG Framework components. The book will explain the practical use of the Selenium page object design pattern in data-driven testing, the Selenium WebDriver Framework components such as the driver class to support local, remote, and third-party grid architectures, building page object classes in Java, building data-driven test classes using the TestNG Framework, and a sample DataProvider using the JSON protocol to encapsulate data for testing.
Other important areas it will cover include support for concurrent multiple drivers, parallel/distributed testing, utilities, test reporter classes, test listener classes, and third-party plugins to the Selenium WebDriver.
There are many "getting started" Selenium manuals in the market today, such as Selenium Testing Tools Cookbook by Packt Publishing. These types of book are great introductions to the Selenium WebDriver technologies, where concepts are broken down into simple steps to allow the user to understand each concept that Selenium, Java, and TestNG bring to the testing world.
Selenium Framework Design in Data-Driven Testing takes those concepts to the next level, assumes that the user has working knowledge of Java, TestNG, and Selenium, and teaches them how to design and build a scalable, efficient, object-oriented, data-driven test framework. In that respect, this manual is geared toward the quality assurance and development professionals responsible for designing and building enterprise-based testing frameworks.
Chapter 1, Building a Scalable Selenium Test Driver Class for Web and Mobile Applications, shows users how to get started with designing and building the Selenium Framework driver class. This class is the engine that drives the browser and mobile applications. With Selenium WebDriver technology, users can test all the popular browsers and mobile devices using the same driver class and programming language. The Selenium WebDriver technology is platform independent and has various language bindings to support cross-browser and device testing in a single code base.
Chapter 2, Selenium Framework Utility Classes, describes how to design Java utility classes to support the framework components that are non-specific to any of the applications under test. Users will learn how to build classes to perform file I/O operations, data extraction, logging, synchronization, result processing, reporting, global variables, and many more.
Chapter 3, Best Practices for Building Selenium Page Object Classes, introduces users to designing and building application-specific classes following the Selenium Page Object Model. Users will be guided through designing abstract base classes, deriving subclasses, and structuring classes to use common inheritance methods to ensure that page elements and methods are stored in central locations. In following these design principles, users will create an abstract separation layer between the page object and test classes in the framework.
Chapter 4, Defining WebDriver and AppiumDriver Page Object Elements, presents users with design techniques to ensure that elements are defined using best practices for locators, minimum number of elements defined in page object classes, how to build locators on the fly, and when to use static verses dynamic locators to test page object elements.
Chapter 5, Building a JSON Data Provider, explains how to design and build a TestNG DataProvider class using the JSON protocol to store data. The concept of data-driven test frameworks is introduced, and how to use a DataProvider to extract data on the fly to ensure that standards for data encapsulation and DRY approaches are being followed is covered.
Chapter 6, Developing Data-Driven Test Classes, explores how to design data-driven test classes using the TestNG technologies. This includes TestNG features such as annotations, parameters, attributes, use of DataProviders in test classes, data extraction, exception handling, and setup/teardown techniques.
Chapter 7, Encapsulating Data in Data-Driven Testing, describes the use of encapsulation in data-driven testing. This will include JSON data manipulation, use of property files, processing JVM arguments, casting JSON data to Java objects, supporting multiple drivers, and parallel testing.
Chapter 8, Designing a Selenium Grid, presents the Selenium Grid Architecture, including designing a virtual grid in the Cloud, how to build the grid hub, browser nodes, and Appium mobile nodes, using the grid console, how to cast tests to the RemoteWebDriver, and supporting third-party grids.
Chapter 9, Third-Party Tools and Plugins, details methodologies in using third-party tools and plugins in the Selenium Framework design. This will include the IntelliJ IDEA Selenium plugin, TestNG for results processing, the HTML Publisher Plugin, BrowserMob, ExtentReports, and Sauce Labs.
Chapter 10, Working Selenium WebDriver Framework Samples, provides users with a real working sample framework including Selenium driver and utility classes, page object base and subclasses, DataProvider class, data-driven test class, JSON data file, TestNG test IListener class, and ExtentReports IReporter classes. Users will be able to install the files in their own project, use the supplied Maven pom.xml file to pull down the required JAR files, and run the sample data-driven tests against a real practice website across multiple browser types.
To get up and running, users will need to have the following technologies installed:
Java JDK 1.8
IntelliJ IDEA 2017.3+
Selenium WebDriver 3.7.1+ JAR
Selenium Stand-alone Server 3.7.1+ JAR
Appium Java Client 5.0.4+ JAR
Appium Server 1.7.1 JAR for iOS or Linux
TestNG 6.11 JAR
ExtentReports 3.1.0 JAR
Browsers: Google Chrome 62.0, Mozilla Firefox 57.0, Microsoft Internet Explorer 11.0
Drivers: chromedriver.exe 2.33, geckodriver.exe 0.19.1, IEDriverServer.exe 3.7.1+
Apple Xcode and iPhone Simulators for iOS
Google Android SDK and Samsung Galaxy emulators for Linux
VMware virtual machines
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub athttps://github.com/PacktPublishing/Selenium-Framework-Design-in-Data-Driven-Testing. We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
In this chapter, we will cover designing and building the Java test driver class required to create and use the Selenium WebDriver API and AppiumDriver API for automated testing. The driver class is the central location for all aspects and preferences of the browser and mobile devices, platforms and versions to run on, support for multithreading, support for the Selenium Grid Architecture, and customization of the driver. This chapter will cover the following topics:
Introduction
The singleton driver class
Using preferences to support browsers and platforms
Using preferences to support mobile device simulators, emulators, and real devices
Multithreading support for use in parallel and distributed testing
Passing optional arguments and parameters to the driver
Selenium Grid Architecture support using the RemoteWebDriver and AppiumDriver classes
Third-party grid architecture support, including the Sauce Labs Test Cloud
Using property files to select browsers, devices, versions, platforms, languages, and so on
In this chapter, users will be introduced to data-driven testing, the Selenium Page Object Model, and Don't Repeat Yourself (DRY) approaches to testing, all of which work hand-in-hand with each other, and are required for scalable frameworks. Let's briefly discuss each.
The premise of data-driven testing is that test methods and test data are separated to allow the adding of new test permutations without changing the test methods, to reduce the amount of code, reduce the amount of maintenance required for testing, and to store common libraries in a central location—those being the page object classes. Data is encapsulated in a central location such as a database, JSON, or CSV file, property file, or an Excel spreadsheet, to name a few. Test methods then allow dynamic data to be passed into them on the fly using parameters and data providers of choice. The test methods themselves become "templates" for positive, negative, boundary, and/or limit testing, extending coverage of the suite of tests with limited code additions.
The Selenium Page Object Model is based on the programming concepts that a page object class should include all aspects of the page under test, such as the elements on the page, the methods for interacting with those elements, variables, and properties associated with the class. Following that concept, there is no data stored in the page object class. The test classes themselves call methods on the page object instances they are testing, but have no knowledge of the granular elements in the class. Finally, the actual test data is encapsulated outside the test class in a central location. In other words, there is an abstract layer created between the tests and the actual page object classes. This reduces the amount of code being written and allows them to be reused in various testing scenarios, thus following the DRY approaches to programming. From a maintenance point of view, changes to methods and locators are made in limited, central places, reducing the amount of time required to maintain ever-changing applications.
DRY approaches to creating page object and test classes simply mean promoting the use of common classes, locators, methods, and inheritance to eliminate and avoid repeating the same actions over and over in multiple places. Instead, abstract base classes are created, containing all common objects and methods, and used as libraries to be called using parameters, which vary based on the data that is passed into them from the test classes. All subclasses derived from these base classes inherit all the common code, objects, locators, and methods, and enforce all of the abstract methods required by the base class. In essence, this approach avoids common copy and paste actions that result in duplicate code in multiple places.
As per Wikipedia (https://en.wikipedia.org/wiki/Data-driven_testing):
Users will learn how to design and build the Java singleton class required to control the Selenium driver of choice for the Application Under Test (AUT).
In this section, a Java singleton class will be used to create the driver class. This will force the user to use the same object for all instances where the WebDriver is required. The WebDriver events will never get out of sync during the run, and all WebDriver events will get sent to the correct browser or mobile device instance. And since the instance of the class is created on a single thread, referencing it won't interfere with other WebDriver instances running on the same node simultaneously.
As per Wikipedia (https://en.wikipedia.org/wiki/Singleton_pattern):
In order to start building the framework, users must import the required JAR files into their project to use the Selenium WebDriver, AppiumDriver, and TestNG APIs. Additionally, there will be various Java JAR files required, such as Apache, Spring, File I/O, and other utilities as the framework develops:
import
io.appium.java_client.AppiumDriver;
import
io.appium.java_client.MobileElement;
import
io.appium.java_client.android.AndroidDriver;
import
io.appium.java_client.ios.IOSDriver;
import
org.openqa.selenium.WebDriver;
import
org.openqa.selenium.chrome.ChromeDriver;
import
org.openqa.selenium.chrome.ChromeOptions;
import
org.openqa.selenium.edge.EdgeDriver;
import
org.openqa.selenium.edge.EdgeOptions;
import
org.openqa.selenium.firefox.*;
import
org.openqa.selenium.ie.InternetExplorerDriver;
import
org.openqa.selenium.remote.DesiredCapabilities;
import
org.openqa.selenium.remote.LocalFileDetector;
import
org.openqa.selenium.remote.RemoteWebDriver;
import
org.openqa.selenium.safari.SafariDriver;
import
org.openqa.selenium.safari.SafariOptions;
import
org.testng.*;
Before introducing the common methods in this driver class, it is prudent to note that requiring JavaDoc for all methods in the class will be helpful for users who are learning the framework. The JavaDoc can be built automatically in Java using a build tool such as Maven, Gradle, or Ant. An example of the JavaDoc format is as follows:
/**
* This is the setDriver method used to create the Selenium WebDriver
* or AppiumDriver instance!
* *
@param parameter 1
*
@param
parameter 2
*
@param
parameter 3
*
@param parameter 4
*
*
@throws
Exception
*/
The driver class will be designed with various get and set methods. The main setDriver method can take parameters to determine the browser or mobile type, platform to run on, environment for testing, and a set of optional preferences to allow changing driver behavior on the fly:
@SafeVarargs
public final void
setDriver
(String browser, String platform, String environment, Map<String, Object>... optPreferences)
Examples of some of the parameters of setDriver are as follows:
browser
: Chrome, Firefox, Internet Explorer, Microsoft Edge, Opera, Safari (iPhone/iPad, or Android for mobile)
platform
: Linux, Windows, Mac, Sierra, Win10 (iPhone/iPad, or Android for mobile)
environment
: Local, remote, and Sauce Labs
optPrefs
: Map of driver preferences (this will be covered later in detail)
The browser preferences and behavior can be set to specific defaults when the driver is created, set on the fly using optional parameters, or set as system properties. Preferences can be set for different languages, geolocations, focus, download folders, and so on. This section will cover the basics of how to set default preferences and capabilities in the driver method.
