🏎️ACTIONS
Actions in web automation are predefined commands that instruct the automation framework to perform specific tasks. Here's a detailed list of actions:
CLICK
Simulates a mouse click on a web element.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,VISIBILITY,NONE,loginButton,CLICK,NONE,NONE,NONETutorial ->
SEND_KEYS
The SEND_KEYS action is a multi-purpose command in web automation that is primarily known for sending keystrokes to web elements. However, it also serves as a supporting action for various commands by providing necessary values or parameters.
Associated Commands
SEND_KEYS can be associated with the following commands to support their actions:
LOAD_URL
Provides the URL to be loaded in the browser.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,LOAD_URL,https://www.saucedemo.com/,NONE,NONE
DEPENDANT_TEST_CASE
Specifies the name of the test case to be executed as a dependency.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,DEPENDANT_TEST_CASE,search,NONE,NONE
PERFORM_PRE_FLOWS
Indicates the specific pre-flow steps to be executed before the main test actions.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,PERFORM_PRE_FLOWS,FIRST_NAME,NONE,NONE SwagLabs,VISIBILITY,NONE,userName,SEND_KEYS,GlobalVariables:FIRST_NAME,NONE,NONE
HARD_WAIT
Defines the duration of the pause in the test execution, typically given in seconds or milliseconds.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,DEPENDANT_TEST_CASE,search,NONE,NONE NONE,NONE,NONE,NONE,HARD_WAIT,3,NONE,NONE
API_EXECUTOR
Sends necessary parameters for the API call being executed within the test.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,API_EXECUTOR,POST,NONE,NONE NONE,NONE,NONE,NONE,LOAD_URL,https://www.saucedemo.com/,NONE,NONE
CUSTOM
Passes custom values or scripts that are required for a custom-defined action.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,CUSTOM,CustomClass:LoadString,NONE,NONEHere CustomClass -> class name and MethodName -> LoadString
FETCH_GMAIL_SUBJECT
Provides a filter or condition to retrieve the subject line of an email from Gmail.
To get gmail body , syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,FETCH_GMAIL_SUBJECT,TestSubject&&30|TestName,NONE,NONE NONE,NONE,NONE,NONE,CUSTOM,CustomClass:fetchBody,NONE,NONEHere TestSubject -> is gmail subject , 30 -> time difference in minutes and TestName -> is by the name with body is stored in globalvariables.

To get Specific String from mail body, syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE NONE,NONE,NONE,NONE,FETCH_GMAIL_SUBJECT,testSubject1&&5&&suffix&&prefix|TestName1,NONE,NONE NONE,NONE,NONE,NONE,CUSTOM,CustomClass:fetchBody,NONE,NONEHere testSubject1 -> is gmail subject , 5 -> time difference in minutes , suffix -> Suffix of the mail body, prefix -> prefix of the mail body, TestName1 -> is by the name with body is stored in globalvariables

EXPLICIT_WAIT_TEXT_PRESENT
Specifies the text for which the automation should wait until it is present on the element.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE SwagLabs,VISIBILITY,NONE,errorMessage,EXPLICIT_WAIT_TEXT_PRESENT,Epic sadface: Username and password do not match any user in this service&&10,NONE,NONEIn sendkeys -> TextToBeWait&&TimeOut
SAVE
Can be used to specify the name or key under which to save element text during the test for later use.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE SwagLabs,VISIBILITY,NONE,errorMessage,SAVE,errormessagename,NONE,NONESendKeys have the name with which element text is saved in global variables.
WAIT_INVISIBILITY
Wait until a web element is no longer visible on the page. Include a timeout in SEND_KEYS to wait until the element is no longer visible
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,VISIBILITY,NONE,errorMessage,WAIT_INVISIBILITY,20,NONE,NONECREATE_NEW_TAB
Opens a new tab in the browser.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
NONE,NONE,NONE,NONE,CREATE_NEW_TAB,NONE,NONE,NONELOAD_URL
Navigates to a specified URL in the browser.
Syntax ->
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
NONE,NONE,NONE,NONE,LOAD_URL,https://www.saucedemo.com/,NONE,NONEGENERATE_RANDOM_EMAIL_ADDRESS
Generates a random email address using the 1secmail API and stores it in KeyInitializers with name getRandomEmail
Syntax ->
Usage ->
Demo:
FETCH_RANDOM_EMAIL_BODY
Retrieves the random email body text of a random email address
suffix -> Suffix of the mail body, prefix -> prefix of the mail body, TestName1 -> is by the name with body is stored in globalvariables
Usage:
Demo:
DEPENDANT_TEST_CASE
Executes steps from a previously defined test case. Learn More here
SWITCH_FRAME_WEB_ELEMENT
Switches the focus to a specified iframe on the page using web element
Syntax ->
Tutorial -> https://youtu.be/JCxqrDVSWBE
SWITCH_FRAME_PARENT
Switches the focus back to the parent frame from an iframe.
Syntax ->
Tutorial -> https://youtu.be/nVJprkIX1dU
FETCH_GMAIL_SUBJECT
Retrieves the subject line of an email from Gmail, typically used in email verification. More info
syntax ->
CLEAR_SEND_KEYS
Clear the web element before sending a character sequence to the web element.
Syntax ->
Tutorial ->
WAIT_FOR_ALERT
Wait for the alert to become visible on the webpage. Include a timeout in SEND_KEYS to wait until the alert is visible. This action should be used along with ALERT_DISMISS, ALERT_ACCEPT, ALERT_GET_TEXT, ALERT_SEND_KEYS
Syntax ->
Tutorial ->
ALERT_GET_TEXT
Retrieve the text from the alert pop-up on the webpage and save it in a global variable.
Syntax ->
Tutorial ->
SWITCH_BY_TITLE
Switch to the window that matches the specified title.
Syntax ->
Tutorial -> https://youtu.be/LHV3EeDRdvM
SWITCH_BY_URL
Switch to the window that matches the specified URL.
Syntax ->
Tutorial -> https://youtu.be/8TlS-Zoeu9w
SWITCH_TO_PARENT_WINDOW
Switch to the main window where the driver has the browser open.
Syntax ->
Tutorial -> https://youtu.be/eIT_himKTFA
SWITCH_FRAME_BY_INDEX
Switch to the window that matches the specified URL.
Syntax ->
Tutorial -> https://youtu.be/I8CKV6U01MQ
Last updated
Was this helpful?