Selenium Test Cases Overview

Updated 1 month ago by Copado Solutions

A Selenium test case is a set of conditions or actions which are performed in a software application in order to verify the expected functionality. With Selenium test cases, a tester will determine whether an application or one of its features is working as it was originally established. 

The test case can be collated into test suites. To learn more about test suites, refer to the article Selenium Test Suites.

Typical Selenium Commands

Command

 Target

Value

 Description

open

url

 

Navigates to the given url, usually a partial url: /xxx/.

click

element

 

Clicks on the element.

type

element

text

Types text into the element.

select

element

label=LABEL

Selects label in the picklist.

copadoCheckbox

element

checked/unchecked

Checks/unchecks the checkbox element.

copadoPopup

element

 

Opens the lookup field element.

copadoPopup

 

 

Closes the last lookup field.

assertXXX

element

 

Asserts that the element is present and visible.

assertXXX

element

value

Asserts that the element is present and visible, and checks that the value/text/picklist value is VALUE.

selectWindow

 

 

Selects the main execution window.

selectPopup

 

 

Selects the last opened window.

pause

milliseconds

 

Pauses the execution for the given number of milliseconds.

captureEntirePageScreenshot

 

 

Creates a screenshot of the entire page. Useful to visually confirm a change.

 copadoSetRetries

 number of retries

 milliseconds

Configures the number of retries. copadoSetRetries 50 1000 will try 50 times, waiting 1 second between each attempt, before failing a command.

 storeValue

 element

 varName

Saves the value of an element in a variable so that it can be used in other parts of the test case by using the following notation: ${varName}.

 storeText

 element

 varName

Saves the text of an element in a variable so that it can be used in another part of the script by using the following notation: ${varName}.

 comment

 text

 

Sets a comment for providing context to the test.

Check out the complete Selenese command reference.

Typical Element Locators

 Locator

Description

copado=field:XXX

Form field with label XXX.

copado=detail:XXX

Form field with label XXX in the SF detail page.

copado=link:XXX

HTML link

copado=button:XXX

HTML button

//XPATH-EXPRESSION

General page element. Several locators of varying length and precision are offered.

id=ID

HTML element with that ID value.

name=NAME

HTML element with that NAME value.

{!Locator.XXX}

The locator with ID XXX in the Selenium Locators tab.


How did we do?