Show Menu

Selenium WebDriver Cheat Sheet by

Selenium Made Easy
browser     selenium     testng     locators     webelement     findelement


Link Text
CSS Selector - Tag and ID, Tag and Class, Tag and Attribute, Tag ID Class and Attribute , Inner Text
DOM - GetEle­men­tById, GetEle­men­tBy­Nam­e,d­om:­nam­e,d­om:­index

Implicit Wait Vs Explicit Wait Vs Fluent Wait

This wait can be considered as element detection timeout. Once defined in a script, this wait will be set for all the Web Elements on a page.
This wait can be considered as condit­ional wait, and is applied to a particular Web Element with a condition
Selenium keeps polling to check whether that element is available to interact with or not.
WebDri­verWait wait = new WebDri­ver­Wai­t(D­river, 90);­nag­e().ti­meo­uts­().i­mp­lic­itl­yWa­it(90, TimeUn­it.S­EC­ONDS);
Fluent Wait you have an element which sometime appears in just 1 second and some time it takes minutes to appear. In that case it is better to use fluent wait, as this will try to find element again and again until it find it or until the final timer runs out.

Browser Commands

Get command
Get Title Command
Get current Url Command
Get Page Source Command
Close Command
Quit Command
Refresh Command

testNG Annota­tions


Web Element Commands

Elements can be found by using
By Id
By Name
By Class Name
By Tag Name
By Link Text
By Partial Link Text
By Xpath

findEl­ement Vs findEl­ements

Returns a single WebElement
Returns List of WebEle­ments.
Syntax: WebElement findEl­eme­nt(By by)
Syntax: java.u­til.Li­st<­Web­Ele­men­t> findEl­eme­nts(By by)
Exception :NoSuc­hEl­eme­ntE­xce­ption


not Selected

Browser Navigation Commands

To Command
Refresh Command
Back Command
Forward Command

Switch Commands



not Checked

Difference between '/' and '//'

Single Slah '/' -> Look for the element immedi­ately inside its parent element
Eg : Absolute path :/html­/bo­dy/­for­m/d­iv/­div­[3]­/[p1]/a
Double Slah '//' -> Look for any child or grand child inside parent element
eg: Releative path ://*[@­id:­log­inf­orm­][p1]/a



Download the Selenium WebDriver Cheat Sheet

1 Page

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

Like this cheat sheet? Check out our sponsors! is a collection of tools to make your writing better. More readable content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!

Click Here To Get Started!



No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Firefox Cheat Sheet
          Selenium WebDriver Cheat Sheet Cheat Sheet