售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Learning Selenium Testing Tools Third Edition
Table of Contents
Learning Selenium Testing Tools Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Selenium IDE
Understanding Selenium IDE
Installing Selenium IDE
Getting acquainted with the Selenium IDE tool
Rules in creating tests with Selenium IDE
Recording your first test with Selenium IDE
Validating a test with assert and verify
Creating comments in your tests
Adding Selenium IDE comments
Multiplying windows
Working with multiple windows
Complex working with multiple windows
Selenium tests against AJAX applications
Working on pages with AJAX
Working with AJAX applications
Storing information from the page in the test
Debugging tests
Creating test suites
Parameterization
Selenium IDE Configuration
Generating source code from Selenium IDE
Saving tests
What you cannot record
Summary
Self-test questions
2. Locators
Locating elements by ID
Finding IDs of elements on the page with Firebug
Finding elements by ID
Moving elements on the page
Finding elements by name
Adding filters to the name
Finding elements by link text
Finding elements by accessing the DOM via JavaScript
Finding elements by XPath
Using direct XPath in your test
Finding elements by direct XPath
Using XPath to find the nth element of a type
Using element attributes in XPath queries
Performing partial match on attribute content
Finding an element by the text it contains
Leveraging the XPath axis with elements
Using the XPath axis
CSS selectors
Finding elements by CSS
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
Working with elements and their attributes
Finding elements by their attributes
Performing partial matches on attributes content
Finding the nth element with CSS
Finding an element by its inner text or partial text
Summary
Self-test questions
3. Overview of the Selenium WebDriver
History of Selenium
Understanding the WebDriver architecture
The WebDriver API
The WebDriver SPI
The JSON Wire Protocol
The Selenium server
Merging of two projects
Setting up the IntelliJ IDEA project
Setting up Eclipse IDE with Java project for Selenium WebDriver and TestNG
Downloading WebDriver JAR files
Downloading and installing Eclipse
Configuring WebDriver with Eclipse
TestNG plug-in installation for Eclipse
Steps for installation
Summary
Self-test questions
4. Finding Elements
Finding elements
Finding an element on the page by its ID
Using findElementById()
Finding elements on the page by their ID
Using findElementsById()
Finding an element on the page by its name
Using findElementByName()
Finding elements on the page by their name
Using findElementsByName()
Finding an element on the page by its ClassName
Using findElementByClassName()
Finding elements on the page by their ClassName
Using findElementsByClassName()
Finding an element on the page by its XPath
Using findElementByXPath()
Finding elements on the page by their XPath
Using findElementsByXpath()
Finding an element on the page by its link text
Using findElementByLinkText()
Finding elements on the page by their link text
Using findElementsByLinkText()
Using findElement Helper methods
Finding elements using a more generic method
Using findElement()
Using findElements()
Tips and tricks
Finding if an element exists without throwing an error
Waiting for elements to appear on the page
Implicit waits
Using implicit waits
Explicit waits
Using explicit waits with Selenium WebDriver
Summary
Self-test questions
5. Design Patterns
Page objects
Setting up the test
Moving Selenium steps into private methods to make tests maintainable
Using the Page Object pattern to design tests
Using Page Factory with Page Object
Using PageFactory
LoadableComponent
Changing our Page Object to use LoadableComponent
Using LoadableComponent
Summary
Self-test questions
6. Working with WebDriver
Working with FirefoxDriver
Firefox profile preferences
Installing a Firefox add-on
Working with ChromeDriver
ChromeOptions
Working with OperaDriver
OperaProfile
Working with InternetExplorerDriver
Other important points
Summary
Self-test questions
7. Automation Framework Development and Building Utilities
Automation without framework
Automation with Framework
Test Automation Frameworks Evolution
Record/Playback
Advantages
Disadvantages
Action driven approach
Advantages
Disadvantages
Data driven approach
Advantages
Disadvantages
Keyword driven method
Advantages
Disadvantages
Hybrid
Environment specifications
Hybrid architecture design
The automation framework structure
The project folder structure
Adding a keyword to a Selenium automation framework
Form an automated test case using keywords
Steps to form an automated test case
Building your own utilities for the Selenium automation framework
Configuration and usage of the framework
Run the automation suite
Execution starts and ends
Summary
Self-test questions
8. Mobile Devices
Working with Android
Emulator
Creating an emulator
Installing the Selenium WebDriver Android Server
Installing the Android Server
Creating a test for Android
Using the Android driver
Running with OperaDriver on a mobile device
Using OperaDriver on Opera Mobile
Working with iOS
Setting up the simulator
Setting up on a real device
Creating a test for iOS devices
Using the iPhone driver
Summary
Self-test questions
9. Getting Started with the Selenium Grid
Understanding Selenium Grid
The Selenium Grid hub
Launching the hub
Adding instances to the hub
Adding a server with the defaults
Adding Selenium Remote Control for different machines
Selenium Server for different machines
Adding Selenium Server to do specific browser tasks on specific operating systems
Setting the environment when starting Selenium Remote Control
Using Selenium Grid 1 with your YAML file
Using Selenium Grid 1 configuration
Running tests against the grid
Writing tests against the grid
Running tests in parallel
Getting our tests running in parallel
Summary
Self-test questions
10. Advanced User Interactions
What is Advanced User Interactions API?
Keyboard
Mouse
The Actions class
Drag and drop
Creating an Actions method chain for dragging and dropping
Moving an element to an offset
Moving an element with a drag and drop by offset
The context click
Doing a context click
Clicking on multiple items in a select element
Selecting multiple items on a select item
Clicking and holding down the mouse
Holding the mouse button down while moving the mouse
Summary
Self-test questions
11. Working with HTML5
Working with application cache
Getting the current status of application cache
Interacting with browser connections
Seeing if the browser is online
Checking the browser status
Setting the browser offline or online
Setting the browser connection
Working with WebStorage
Local storage
Accessing localStorage
Session storage
Accessing sessionStorage
Summary
Self-test questions
12. Advanced Topics
Capturing screenshots
Capturing the base64 version of images
Image capturing as base64 strings
Saving the screenshot to bytes
Saving images to bytes
Saving a screenshot to file
Using XVFB with Selenium
Setting up XVFB server
Running tests in XVFB
Working with BrowserMob Proxy
Creating and starting a proxy
Capturing network traffic
Summary
Self-test questions
13. Migrating from Remote Control to WebDriver
WebDriverBackedSelenium
Converting tests to Selenium WebDriver using WebDriverBackedSelenium
Summary
Self-test question
A. Automation Prerequisites for Selenium Automation
About Java programming
How does Java work?
Package
Class
Objects
Importing the sample Java project in the Eclipse workspace
A simple Java program example
Inheritance
A Java program with an inheritance example
An abstract class
An example of a Java program with an abstract class
Polymorphism
Overloading
An example of a Java program with overloading
Overriding
An example of a Java program with overriding
Encapsulation
An example of a Java program using encapsulation
Constructors
An example of a Java program with a constructor chain
Interface
An example of a Java program with an interface
Abstract classes compared with interfaces
The this keyword
Data types and variables in Java
Data types
Variables
Local variables
Instance variables
Class/static variables
Type casting
Widening
Narrowing
Example on widening and narrowing
Java operators
A simple assignment operator
Arithmetic operators
Unary operators
Equality and relational operators
Conditional operators
Type comparison operator
Bitwise and bit shift operators
Operator precedence
Decision and control statements
The if statement
The if...else statement
The if...else if...else statement
The nested if...else statement
The switch statement
Loops
The while loop
The do...while loop
The for loop
The for each loop in Java
The break keyword
The continue keyword
String class functions
The charAt() function
The equalsIgnoreCase() function
The length() function
The replace() function
The substring() function
The toLowerCase() function
The toUpperCase() function
The trim() function
Collections
What is a Collections framework?
Exception handling
Types of exceptions
Exception handler components
The throw keyword
Java IO
The FileOutputStream class
The FileInputStream class
Java coding standards
Why are coding standards required?
Summary
Self-test Questions
B. Answers for Self-test Questions
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Appendix A
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜