万本电子书0元读

万本电子书0元读

顶部广告

Learn Selenium电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Unmesh Gundecha

出  版  社:Packt Publishing

出版时间:2019-07-18

字       数:58.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Learn end-to-end automation testing techniques for web and mobile browsers using Selenium WebDriver, AppiumDriver, Java, and TestNG Key Features * Explore the Selenium grid architecture and build your own grid for browser and mobile devices * Use ExtentReports for processing results and SauceLabs for cloud-based test services * Unlock the full potential of Selenium to test your web applications. Book Description Selenium WebDriver 3.x is an open source API for testing both browser and mobile applications. With the help of this book, you can build a solid foundation and can easily perform end-to-end testing on web and mobile browsers.You'll begin by being introduced to the Selenium Page Object Model for software development. You'll architect your own framework with a scalable driver class, Java utility classes, and support for third-party tools and plugins. You'll design and build a Selenium grid from scratch to enable the framework to scale and support different browsers, mobile devices, and platforms.You'll strategize and handle a rich web UI using the advanced WebDriver API and learn techniques to handle real-time challenges in WebDriver. You'll perform different types of testing, such as cross-browser testing, load testing, and mobile testing. Finally, you will also be introduced to data-driven testing, using TestNG to create your own automation framework.By the end of this Learning Path, you'll be able to design your own automation testing framework and perform data-driven testing with Selenium WebDriver. This Learning Path includes content from the following Packt products: * Selenium WebDriver 3 Practical Guide - Second Edition by Unmesh Gundecha * Selenium Framework Design in Data-Driven Testing by Carl Cocchiaro What you will learn * Use different mobile and desktop browser platforms with Selenium 3 * Use the Actions API for performing various keyboard and mouse actions * Design the Selenium Driver Class for local, remote, and third-party grid support * Build page object classes with the Selenium Page Object Model * Develop data-driven test classes using the TestNG framework * Encapsulate data using the JSON protocol * Build a Selenium Grid for RemoteWebDriver testing * Build and use utility classes in synchronization, file I/O, reporting and test listener classes Who this book is for This Learning Path is ideal for software quality assurance/testing professionals, software project managers, or software developers interested in using Selenium for testing their applications. Professionals responsible for designing and building enterprise-based testing frameworks will also find this Learning Path useful. Prior programming experience in Java are TestNG is necessary.
目录展开

Contributors

About the authors

Packt is searching for authors like you

About Packt

Why subscribe?

Packt.com

Preface

Who this book is for

What this book covers

To get the most out of this book

Installing Java

Installing Eclipse

Download the example code files

Conventions used

Get in touch

Reviews

Introducing WebDriver and WebElements

Selenium Testing Tools

Selenium WebDriver

Selenium Server

Selenium IDE

Differences between Selenium 2 and Selenium 3

Handling the browser

Having better APIs

Having developer support and advanced functionalities

Testing Mobile Apps with Appium

Setting up a project in Eclipse with Maven and TestNG using Java

WebElements

Locating WebElements using WebDriver

The findElement method

The findElements method

Inspecting Elements with Developer Tools

Inspecting pages and elements with Mozilla Firefox

Inspecting pages and elements in Google Chrome with Developer Tools

Using the By locating mechanism

The By.id() method

The By.name() method

The By.className() method

The By.linkText() method

The By.partialLinkText() method

The By.tagName() method

The By.xpath() method

The By.cssSelector() method

Interacting with WebElements

Getting element properties and attributes

The getAttribute() method

The getText() method

The getCssValue() method

The getLocation() method

The getSize() method

The getTagName() method

Performing actions on WebElements

The sendKeys() method

The clear() method

The submit() method

Checking the WebElement state

The isDisplayed() method

The isEnabled() method

The isSelected() method

Summary

Questions

Further information

Using Java 8 Features with Selenium

Introducing Java 8 Stream API

Stream.filter()

Stream.sort()

Stream.map()

Stream.collect()

Stream.min() and Stream.max()

Stream.count()

Using Stream API with Selenium WebDriver

Filtering and counting WebElements

Filtering element attributes

Using the Map function to get the text value from elements

Filtering and performing actions on WebElements

Summary

Questions

Further information

Exploring the Features of WebDriver

Taking screenshots

Locating target windows and Frames

Switching among windows

Switching between frames

Handling alerts

Exploring Navigate

Waiting for WebElements to load

Implicit wait time

Explicit wait time

Handling cookies

Summary

Questions

Further information

Exploring Advanced Interactions of WebDriver

Understanding the build and perform actions

Learning mouse based interactions

The moveByOffset action

The click at current location action

The click on a WebElement action

The click and hold at current location action

The click and hold a WebElement action

The release at current location action

The release on another WebElement action

The moveToElement action

The dragAndDropBy action

The dragAndDrop action

The double click at current location action

The double click on WebElement action

The context click on WebElement action

The context click at current location action

Learning keyboard-based interactions

The keyDown and keyUp actions

The sendKeys method

Summary

Questions

Further information

Understanding WebDriver Events

Introducing the eventFiringWebDriver and eventListener classes

Creating an instance of EventListener

Implementing WebDriverEventListener

Extending AbstractWebDriverEventListener

Creating a WebDriver instance

Creating EventFiringWebDriver and EventListener instances

Registering EventListener with EventFiringWebDriver

Executing and verifying the events

Registering multiple EventListeners

Exploring different WebDriver event listeners

Listening for WebElement value changes

Listening for the clicked WebElement

Listening for a WebElement search event

Listening for browser back-navigation

Listening for browser forward-navigation

Listening for browser NavigateTo events

Listening for script execution

Listening for an exception

Unregistering EventListener with EventFiringWebDriver

Performing accessibility testing

Capturing page-performance metrics

Summary

Questions

Further information

Exploring RemoteWebDriver

Introducing RemoteWebDriver

Understanding Selenium Standalone Server

Downloading Selenium Standalone Server

Running the server

Understanding the RemoteWebDriver client

Converting an existing test script to use the RemoteWebDriver server

Using RemoteWebDriver for Firefox

Using RemoteWebDriver for Internet Explorer

Understanding the JSON wire protocol

Summary

Questions

Further information

Setting up Selenium Grid

Exploring Selenium Grid

Understanding the hub

Understanding the node

Modifying the existing test script to use Selenium Grid

Requesting for non-registered capabilities

Queuing up the request if the node is busy

Dealing with two nodes with matching capabilities

Configuring Selenium Grid

Specifying node-configuration parameters

Setting supported browsers by a node

Setting node timeouts

Setting the limit on browser instances

Reregistering the node automatically

Setting node health-check times

Unregistering an unavailable node

Setting the browser timeout

Hub-configuration parameters

Waiting for a match of the desired capability

Customized CapabilityMatcher

WaitTimeout for a new session

Different ways to specify the configuration

Using cloud-based grids for cross-browser testing

Summary

Questions

Further information

Data-Driven Testing with TestNG

Overview of data-driven testing

Parameterizing Tests using suite parameters

Parameterizing Tests with a Data Provider

Reading data from a CSV file

Reading data from an Excel file

Summary

Questions

Further information

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

Assessments

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部