Web Automation Using Selenium

Sandip Southekal

southekal.com

Plan

  • What is Selenium?
  • What is Selenium?
  • Why Web Automation?
  • What is Selenium?
  • Why Web Automation?
  • Types of Selenium
  • What is Selenium?
  • Why Web Automation?
  • Types of Selenium
  • Examples
  • What is Selenium?
  • Why Web Automation?
  • Types of Selenium
  • Examples
  • Pitfalls
  • What is Selenium?
  • Why Web Automation?
  • Types of Selenium
  • Examples
  • Pitfalls
  • Continuous Integration
  • What is Selenium?
  • Why Web Automation?
  • Types of Selenium
  • Examples
  • Pitfalls
  • Continuous Integration
  • Other Uses

What is Selenium?

  • automates browsers (Firefox, Chrome, Safari, PhantomJS etc..)
  • mimics user actions
  • JSON Wire Protocol to interact with DOM elements

Why Web Automation?

Famous Last Words

clicking on the link does not do anything!

looks borked on IE

doesn't work on my phone

unable to login

Why Selenium?

  • agile
  • repeatability
  • speed
  • rapid feedback
  • unlimited iterations
  • UI is fairly stable

Types of Selenium


Selenium IDE


Pros:

  • simple firefox plugin
  • record and playback Tool
  • rapid prototyping


Cons:

  • no iteration support
  • no conditional statement support
  • firefox only

Selenium WebDriver



  • supports WebDriver API
  • makes a direct call to the browser
  • cross browser coverage
  • Java, Python, Ruby, Perl, C# + more libraries available
  • find locators via IDs, Classes, CSS Selectors, XPATH, Tags

Selenium Grid



  • run tests in parallel on remote machines
  • connect to a remote machine that has a particular browser version
  • hub and node model
  • setup in house or farm it to Sauce Labs, BrowserStack etc..

Pitfalls

  • adding sleeps
  • javascript elements
  • browser behavior
  • constant site updates (page object, data attributes)
  • database validation (running tests in parallel)

Continuous Integration

  • Jenkins
  • Travis
  • Circle CI
  • and many more...

Other Use Cases

  • Web Scraping
  • Monitoring
  • Load Testing