Selenium Java

In this series of Selenium Tutorials, we cover topics, use cases, and scenarios, that we try to address using Java programming.


Section 1 – Getting Started

The following tutorials help us to setup Selenium in our PC / Mac, and get started with an example Selenium program.

Selenium Java – Example


Section 2 – Working with Links

Links are the most common web elements we interact with. The following tutorials cover concepts of finding links based on text, partial text, URL etc., and other use cases specific to link elements.

Selenium Java – Click link based on link text

Selenium Java – Click link based on partial link text

Selenium Java – Get all links in the webpage

Selenium Java – Find broken links in webpage

Selenium Java – Find link by href


Section 3 – Keyboard Actions

Selenium can simulate keyboard actions. The following tutorials cover topics of entering a key or multiple keys from keyboard using Selenium.

Selenium Java – Typing Enter/Return key programmatically


Section 4 – Working with Web Elements

A web page consists of web elements. Paragraph is a web element, Link is a web element, Headings are web elements, Div is a web element, etc.

The following tutorials cover how to find web elements based on distinguishing parameters, how to get attributes and/or the respective values of a web element, how to interact with the web elements simulating a user, etc.

Selenium Java – Find element by class name

Selenium Java – Find element(s) by tag name

Selenium Java – Find element(s) by attribute’s value

Selenium Java – Click a button

Selenium Java – Get width and height of an element

Selenium Java – Get tag name of element

Selenium Java – Get visible text of element

Selenium Java – Get inner HTML of element

Selenium Java – Get outer HTML of element

Selenium Java – Get position/coordinates of element

Selenium Java – Get count of all web elements on the webpage

Selenium Java – Get parent element

Selenium Java – Get next sibling element

Selenium Java – Get previous sibling element

Selenium Java – Get all sibling elements

Selenium Java – Check if element is displayed

Selenium Java – Get value of specific CSS property for element


Section 5 – Web Page level Tutorials

The following tutorials cover the Web Page level properties, and use cases.

Selenium Java – Get title of the webpage

Selenium Java – Get current webpage URL

Selenium Java – Get page-source or HTML source

Selenium Java – Get scroll position


Section 6 – Working with JavaScript

Selenium can run the given JavaScript code in the current browser window. The following tutorials help us to understand some of the use cases related to JavaScript for the current web page using Selenium.

Selenium Java – Execute custom JavaScript


Section 7 – Working with Cookies

The following tutorials cover the create, read, and delete operations on cookies.

Selenium Java – Get all cookies

Selenium Java – Get cookie by name

Selenium Java – Add a cookie

Selenium Java – Delete all cookies

Selenium Java – Delete cookie by name


Section 8 – Window Management

The browser window that is opened by Selenium can be managed in terms of size, OS level operations like: maximize, minimize, etc., taking a screenshot of the window, etc.

Selenium Java – Get browser window size

Selenium Java – Set browser window size

Selenium Java – Set specific width for browser window

Selenium Java – Set specific height for browser window

Selenium Java – Maximize browser window

Selenium Java – Minimize browser window

Selenium Java – Take screenshot of the current browser window


Section 9 – Browser Navigation

Browser’s navigation button’s like forward button, back button, and refresh button can be accessed using Selenium.

Selenium Java – Load new URL in current browser window

Selenium Java – Press browser’s back button

Selenium Java – Press browser’s forward button

Selenium Java – Refresh the current webpage


Section 10 – Solving Issues

The following tutorials cover some of the issues or road blocks that occur when working with Selenium in Java.

Selenium Java – wait() java.lang.IllegalMonitorStateException: current thread is not owner