Selenium WebDriver Recipes in Node.js
Selenium WebDriver Recipes in Node.js
$9.99
Minimum price
$19.99
Suggested price
Selenium WebDriver Recipes in Node.js

This book is 100% complete

Completed on 2018-11-13

About the Book

Selenium WebDriver is a popular browser automation framework, testers or developers with Selenium skills are in high demand.   It is easy to get started with Selenium, but do you use effectively for testing real-world test scenarios? Such as data driving test from an Excel spreadsheet and handling pop up dialogs.

Selenium WebDriver Recipes will show you solutions to your problems from the experts who have already solved them. All recipe test scripts  (~200 in JavaScript language) are ready-to-run, i.e., I created the target web pages and test sites, so that you can simply find the recipes and run, in a matter of seconds. Owning this book is like having a test automation coach sitting next to you.

About the Author

Zhimin Zhan
Zhimin Zhan

Zhimin Zhan is the founder and principal agile testing coach of AgileWay Pty Ltd, Australia. As an advisor and coach, he helps organzations by implementing test automation with Continuous Testing using open technologies such as Selenium WebDriver and RSpec. Zhimin is the creator of TestWise, the next-generation functional testing tool that supports functional test refactorings and BuildWise, an award-winning Continuous Testing Server. Zhimin is a frequent speaker and author of 11 books on software testing and programming. He shares his test automation and CI experience at testwisely.com.

Bundles that include this book

Selenium WebDriver Recipes in Ruby
Selenium WebDriver Recipes in Java
Selenium WebDriver Recipes in Python
Selenium WebDriver Recipes in Node.js
4 Books
$79.96
Suggested Price
$28.00
Bundle Price

Table of Contents

  • Preface
    • Who should read this book
    • How to read this book
    • Recipe test scripts
    • Send me feedback
  • 1. Introduction
    • 1.1 Selenium language bindings
    • 1.2 Install Node.JS
    • 1.3 Write first script with JavaScript editor
    • 1.4 Install Selenium WebDriver
    • 1.5 Run script
    • 1.6 Cross browser testing
    • 1.7 Mocha Test Framework
    • 1.8 Create package.json file
    • 1.9 Run recipe test scripts
  • 2. Locating web elements
    • 2.1 Start browser
    • 2.2 Find element by ID
    • 2.3 Find element by Name
    • 2.4 Find element by Link Text
    • 2.5 Find element by Partial Link Text
    • 2.6 Find element by XPath
    • 2.7 Find element by Tag Name
    • 2.8 Find element by Class
    • 2.9 Find element by CSS
    • 2.10 Chain findElement to find child elements
    • 2.11 Use locator name as JSON attribute
    • 2.12 Find multiple elements
  • 3. Hyperlink
    • 3.1 Click a link by text
    • 3.2 Click a link by ID
    • 3.3 Click a link by partial text
    • 3.4 Click a link by XPath
    • 3.5 Click Nth link with exact same label
    • 3.6 Click Nth link by CSS Selector
    • 3.7 Verify a link present or not?
    • 3.8 Getting link data attributes
    • 3.9 Test links open a new browser window
  • 4. Button
    • 4.1 Click a button by label
    • 4.2 Click a form button by label
    • 4.3 Submit a form
    • 4.4 Click a button by ID
    • 4.5 Click a button by name
    • 4.6 Click a image button
    • 4.7 Click a button via JavaScript
    • 4.8 Assert a button present
    • 4.9 Assert a button enabled or disabled?
  • 5. TextField and TextArea
    • 5.1 Enter text into a text field by name
    • 5.2 Enter text into a text field by ID
    • 5.3 Enter text into a password field
    • 5.4 Clear a text field
    • 5.5 Enter text into a multi-line text area
    • 5.6 Assert value
    • 5.7 Focus on a control
    • 5.8 Set a value to a read-only or disabled text field
    • 5.9 Set and assert the value of a hidden field
  • 6. Radio button
    • 6.1 Select a radio button
    • 6.2 Clear radio option selection
    • 6.3 Assert a radio option is selected
    • 6.4 Iterate radio buttons in a radio group
    • 6.5 Click Nth radio button in a group
    • 6.6 Click radio button by the following label
    • 6.7 Customized Radio buttons - iCheck
  • 7. CheckBox
    • 7.1 Check by name
    • 7.2 Check by id
    • 7.3 Uncheck a checkbox
    • 7.4 Assert a checkbox is checked (or not)
    • 7.5 Customized Checkboxes - iCheck
  • 8. Select List
    • 8.1 Select an option by text
    • 8.2 Select an option by value
    • 8.3 Select multiple options
    • 8.4 Select options by index
    • 8.5 Assert the value of a select list
  • 9. Navigation and Browser
    • 9.1 Go to a URL
    • 9.2 Visit pages within a site
    • 9.3 Perform actions from right click context menu such as ‘Back’, ‘Forward’ or ‘Refresh’
    • 9.4 Open browser in certain size
    • 9.5 Maximize browser window
    • 9.6 Move browser window
    • 9.7 Minimize browser window
    • 9.8 Scroll focus to control
    • 9.9 Switch between browser windows or tabs
    • 9.10 Remember current web page URL, then come back to it later
  • 10. Assertion
    • 10.1 Assert page title
    • 10.2 Assert Page Text
    • 10.3 Assert Page Source
    • 10.4 Assert Label Text
    • 10.5 Assert Span text
    • 10.6 Assert Div text or HTML
    • 10.7 Assert Table text
    • 10.8 Assert text in a table cell
    • 10.9 Assert text in a table row
    • 10.10 Assert image present
    • 10.11 Assert element location and width
    • 10.12 Assert element CSS style
    • 10.13 Assert JavaScript errors on a web page
  • 11. Frames
    • 11.1 Testing Frames
    • 11.2 Testing iframe
    • 11.3 Test multiple iframes
  • 12. Testing AJAX
    • 12.1 Wait within a time frame
    • 12.2 Explicit Waits until Time out
    • 12.3 Implicit Waits until Time out
    • 12.4 Wait AJAX Call to complete using JQuery
  • 13. File Upload and Popup dialogs
    • 13.1 File upload
    • 13.2 JavaScript pop ups
    • 13.3 Timeout on a test
    • 13.4 Modal style dialogs
    • 13.5 Internet Explorer modal dialog
  • 14. Debugging Test Scripts
    • 14.1 Print text for debugging
    • 14.2 Write page source or element HTML into a file
    • 14.3 Take screenshot
    • 14.4 Run single test case with Mocha
    • 14.5 Run tests matching a pattern with Mocha
    • 14.6 Leave browser open after test finishes
  • 15. Test Data
    • 15.1 Get date dynamically
    • 15.2 Get a random boolean value
    • 15.3 Generate a number within a range
    • 15.4 Get a random character
    • 15.5 Get a random string at fixed length
    • 15.6 Get a random string in a collection
    • 15.7 Generate random person names, emails, addresses with Faker
    • 15.8 Generate a test file at fixed sizes
    • 15.9 Retrieve data from Database
  • 16. Browser Profile and Capabilities
    • 16.1 Get browser type and version
    • 16.2 Set HTTP Proxy for Browser
    • 16.3 Verify file download in Chrome with Custom User Preferences
    • 16.4 Test downloading PDF in Firefox with Custom Profile
    • 16.5 Bypass basic authentication by embedding username and password in URL
    • 16.6 Bypass basic authentication with Firefox AutoAuth plugin
    • 16.7 Manage Cookies
    • 16.8 Headless browser testing with PhantomJS
    • 16.9 Headless Chrome
    • 16.10 Headless Firefox
    • 16.11 Test responsive web pages
  • 17. Advanced User Interactions
    • 17.1 Double click a control
    • 17.2 Move mouse to a control - Mouse Over
    • 17.3 Click and hold - select multiple items
    • 17.4 Context Click - right click a control
    • 17.5 Drag and drop
    • 17.6 Drag slider
    • 17.7 Send key sequences - Select All and Delete
    • 17.8 Click a specific part of an image
  • 18. HTML 5 and Dynamic Web Sites
    • 18.1 HTML5 Email type field
    • 18.2 HTML5 Time Field
    • 18.3 Invoke ‘onclick’ JavaScript event
    • 18.4 Invoke JavaScript events such as ‘onchange’
    • 18.5 Scroll to the bottom of a page
    • 18.6 Select2 - Single Select
    • 18.7 Select2 - Multiple Select
    • 18.8 AngularJS web pages
    • 18.9 Ember JS web pages
    • 18.10 “Share Location” with Firefox
    • 18.11 Faking Geolocation with JavaScript
    • 18.12 Save a canvas to PNG image
    • 18.13 Verify dynamic charts
  • 19. WYSIWYG HTML editors
    • 19.1 TinyMCE
    • 19.2 CKEditor
    • 19.3 SummerNote
    • 19.4 CodeMirror
  • 20. Leverage Programming
    • 20.1 Raise exceptions to fail test
    • 20.2 Ignorable test statement error
    • 20.3 Read external file
    • 20.4 Data-Driven Tests with CSV
    • 20.5 Identify element IDs with dynamically generated long prefixes
    • 20.6 Sending special keys such as Enter to an element or browser
    • 20.7 Use of Unicode in test scripts
    • 20.8 Extract a group of dynamic data : verify search results in order
    • 20.9 Verify uniqueness of a set of data
    • 20.10 Extract dynamic visible data rows from a results table
    • 20.11 Extract dynamic text following a pattern using Regex
  • 21. Optimization
    • 21.1 Assert text in page_source is faster than the text
    • 21.2 Getting text from more specific element is faster
    • 21.3 Avoid programming if-else block code if possible
    • 21.4 Enter large text into a text box
    • 21.5 Use Environment Variables to change test behaviours dynamically
    • 21.6 Testing web site in two languages
  • 22. Gotchas
    • 22.1 Test starts browser but no execution with blank screen
    • 22.2 Failed to assert copied text in browser
    • 22.3 The same test works for Chrome, but not IE
    • 22.4 “unexpected tag name ‘input’”
    • 22.5 Element is not clickable or not visible
  • 23. Material Design Web App
    • 23.1 Select List (dropdown)
    • 23.2 Checkbox
    • 23.3 Drag range (noUiSlider)
    • 23.4 Verify Toast message
    • 23.5 Modal
  • 24. Selenium Remote Control Server
    • 24.1 Selenium Server Installation
    • 24.2 Execute tests in specified browser on another machine
    • 24.3 Selenium Grid
  • Appendix - Continuous Testing
    • Verify server machine can run Selenium Mocha
    • Install BuildWise Server
    • Create Build Project in BuildWise
    • Trigger test execution manually
    • Feedback while test execution in progress
    • Build finished
    • Notification
    • Review
  • Afterword
  • Resources
    • Books
    • Web Sites
    • Tools

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub