Skip to content

Learn Scripting by Example

  1. Overview

  2. List of Examples by Command Category

  3. List of Examples by UI Element

  4. 'Array Creation and Manipulation' Command Category Examples Listing

  5. 'Conditional (Branching) Control' Command Category Examples Listing

  6. 'Looping & Jumping Flow Control' Command Category Examples Listing

  7. 'Math & String manipulation' Command Category Examples Listing

  8. 'Creation and Assignment of 'Labels'' Command Category Examples Listing

  9. 'Email' Command Category Examples Listing

  10. 'Exception Handling' Command Category Examples Listing

  11. 'Keyboard Actions' Command Category Examples Listing

  12. 'Logging and Reporting on 'Application Performance'' Command Category Examples Listing

  13. 'JSON Creation and Manipulation' Command Category Examples Listing

  14. 'Interacting w/ Web Services using wsCONNECT' Command Category Examples Listing

  15. 'Interacting w/ Databases using dbCONNECT' Command Category Examples Listing

  16. 'Excel' Command Category Examples Listing

  17. "Accessing Contents of Files and persisting files in 'Files' Module" Command Category Examples Listing

  18. Attaching a Data File to an Email

  19. Attaching a File to an Email

  20. Composing and sending an email

  21. How do I enter text in an input field

  22. Examples for wsCONNECT Commands

  23. How do I append text in an input field

  24. How do I clear text in an input field

  25. How do I simulate "Enter" action along with data entry

  26. How do I simulate "Tab" action along with data entry

  27. How do I validate the value in an input field

  28. How do I validate if a particular option of the drop-down is selected

  29. How do I read the value of an input field

  30. To enter the value based on the condition

  31. How do I select an option in the drop-down

  32. How do I read if a radio button is selected or not

  33. How do I validate the selected options of a multi-select drop-down

  34. How do I validate if a particular option of the drop-down is NOT selected

  35. How do I read the option(s) selected in the drop-down

  36. How do I select a Radio button

  37. How do I validate if a particular radio button is selected

  38. How do I select/check a checkbox

  39. How do I unselect/uncheck a checkbox

  40. How do I validate that a particular checkbox is selected/checked

  41. How do I validate that a particular checkbox is not selected/checked

  42. 'XML Creation And Manipulation' Command Category Examples Listing

  43. How do I attach a screenshot captured within the test into the Email

  44. How do I insert a screenshot captured within the test into the Email Body

  45. How do I insert a screenshot captured within the test for the last executed test instruction into the Email Body

  46. How do I insert a screenshot captured within the test for the last failed test instruction into the Email Body

  47. How do I insert a screenshot captured within the test for the last failed test instruction containing a specific command into the Email Body

  48. How do I insert a screenshot captured within the test for the first failed test instruction containing a specific command into the Email Body

  49. How do I append the contents of a Dataset into the Email Body

  50. How do I append the contents of a Data File into the Email Body

  51. Creating the Email Body from HTML

  52. Customizing the Look & Feel (Style) of the Tables within the Email Body

  53. Merge the values from dataset into the variables within the Email body

  54. How do I print a string or value

  55. How do I read the visibility of an element

  56. How do I validate the element is visible

  57. How do I click on a link

  58. How do I get the required element into viewport

  59. How do I click at specific coordinates

  60. How do I validate the text on UI

  61. How do I get number of records from a data file

  62. How do I read data from a data file

  63. How do I perform an arithmetical sum operation

  64. How do I perform an arithmetical product operation

  65. How do I transfer the execution control from one block of code to another block by a label when the specific condition is met

  66. How do I open a new window

  67. How do I validate if a particular radio button is not selected

  68. How do I validate the color of the element

  69. How do I store the text of an element

  70. How do I perform specific steps on any command failure in the test run

  71. How do I get the details (instruction Id & instruction) of the failed command(s) in the test run

  72. How to get command details (Target, Value) of the failed command(s) in the test run

  73. How to script conditions using if-else-endIf construct

  74. How do I immediately end the test

  75. How do I shift the focus from a particular element

  76. How do I Press 'Enter' in the Keyboard

  77. How do I clear the contents

  78. How do I close an overlay on the screen

  79. How do I press 'Up' arrow in the keyboard

  80. How do I press 'Down' arrow in the keyboard

  81. How do I press 'Left' arrow in the keyboard

  82. How do I press 'Right' arrow in the keyboard

  83. How do I perform 'Shift'+'Tab' action in the keyboard

  84. How do I fetch the length of the string

  85. How to script multiple conditions using if-elseIf-else-endIf construct

  86. How to iterate through a block of code until a condition is met

  87. How to set text when the element is in read-only state

  88. Downloading file from the AUT in a device (iOS/Android)

  89. How do I retrieve the values from an Excel File

  90. Providing device permissions while downloading a file from the AUT (iOS/Android)

  91. To automate iFrames in iOS Devices

  92. How do I simulate "Enter" action along with data entry

  93. How to work with elements inside a frame

  94. How to switch the focus of the elements between frames

  95. How to select the popup window on the UI

  96. How to handle application prompts

  97. How to handle application alerts

  98. How to handle application confirmations

  99. How do I get number of fields/columns read from a data file

  100. How do I get a specific cell value from a data file

  101. How do I get a specific Row values from the dataset

  102. How do I set value to a cell in the dataset

  103. How do I assign values to a row in a dataset

  104. How do I save data in row/column format to a data file

  105. How to summarize the data from a datafile using SQL query and persist the summarized data to a datafile

  106. How do I create a JSON object from the contents of a data file

  107. How do I create a JSON Object from the contents of a dataset

  108. How do I validate whether the input provided is a valid JSON

  109. How do I compare two different JSONs

  110. How do I insert data into a JSON object

  111. How do I merge two or more JSON objects to a single object

  112. How do I remove data from a JSON object

  113. How do I replace existing keys in the JSON object by path

  114. How do I replace existing values in the JSON object by path

  115. How do I append the values to an array within the JSON object

  116. How do I check for the occurrence of a specific value in a JSON

  117. How do I retrieve values from JSON object using "index" or "name" as reference and store it in a variable

  118. How do I retrieve an object from JSON using "index" as a reference

  119. How do I unquote JSON values and returns the result as a string

  120. How do I add CDATA within an XML document at the given path

  121. How do I append values to the end of the indicated NodeList within an XML document

  122. How do I check whether the given path exists in the given XML

  123. How do I validate the syntax of the XML string.

  124. How do I add comment to an XML string

  125. How do I convert a Data File into a XML Node structure

  126. How do I convert a Dataset into a XML Node structure

  127. How do I get the maximum depth of the JSON object and length (size) of an array for the defined path in the JSON object

  128. How do I get values from a JSON object for the defined path

  129. How do I extract the values from the given path in a XML string

  130. How do I get the depth and length of a XML string

  131. How do I insert data in the XML document at the given path or value

  132. How do I retrieve the node list from the given XML document using "index" and "name"

  133. How do I remove data in the XML document at the given path or value

  134. How do I replace existing keys/values in an XML document

  135. How do I check a specific value is present in the input XML document

  136. How do I set the "attributename" and "attributevalue" in given nodes of an XML document

  137. How do I execute the SQL query in the test run

  138. How do I get SQL Error Details (Code, Text) of the executed Query in the test run

  139. How do I specify the maximum size of the result set to display after executing the query in the test run

  140. How do I set the "timeout" for SQL Queries in the test run

  141. How do I validate whether the given path exists within a JSON

  142. How do I compare two XML strings

  143. How do I access a GET service - REST

  144. How do I access a POST service - REST

  145. How do I access a PUT service using REST

  146. How do I access a DELETE service - REST

  147. How do I use different authorization methods with REST Services

  148. How do I assign label to a test run automatically

  149. How do I transfer the execution control from one block of code to other block by a label

  150. How do I access a REST service which has URL/Query parameters

  151. How do I set the Header parameters and access a REST service

  152. How do I access a web service which is not accessible in the public domain

  153. How do I read the Error message from the JSON Response for a REST Service

  154. How do I set timeout for a web service request

  155. How do I perform an arithmetical average operation

  156. How do I generate a random number within provided range of integers

  157. How do I replace all the occurrences of a substring with another substring

  158. How do I fetch the position of the first occurrence of a specific value in string

  159. How do I generate the timestamp in a specific format

  160. How do I perform arithmetic operations on numbers with special characters like currency symbol or comma

  161. How do I round off the decimal values to two digits

  162. How do I split a sentence or words that are separated by a comma

  163. How do I extract the part of a string from a large string or a sentence

  164. How do I fetch the position of the last occurrence of a specific value in string

  165. How do I fetch only few elements in a list of items/array

  166. How do I sort the list of items(alphabetic/numeric) in an array either in ascending/descending order

  167. How do I append generated Cumulative Load Timings with in TimeforTestInstructions block to a Dataset

  168. How do I capture application response time

  169. How do I capture and print cumulative load timing for set of instructions in Transaction Detail Report

  170. How do I update the values in an Excel File

  171. How do I skip the execution of code inside the loop for the current iteration and move the control to the beginning of the loop for next iteration

  172. How do I skip specific set of lines of code during execution

  173. How do I select multiple options from a drop down

  174. How do I access a SOAP service request

  175. How to use oAuth commands for different grant types

  176. How to read data from an Json file (stored in Files module) from within my test run

  177. How to read data from an Xml file (stored in Files module) from within my test run

  178. How to store data to a Json file in Files module from within a test run

  179. How to store data to a Xml file in Files module from within a test run

  180. How do I close a native mobile app?

  181. How do I uninstall a native mobile app?

  182. How do I perform tap action based on the coordinate values in a Mobile App

  183. How do I perform rotate action in a Mobile App

  184. How do I double tap in a Mobile App

  185. How do I perform double tap action based on the coordinate values in a Mobile App

  186. How do I zoom in a mobile app?

  187. How do I store app package information?

  188. How do I store app activity information?

  189. How do I get the size of an element for a native mobile app?

  190. How do I open a closed mobile application?

  191. How do I tap on elements in mobile apps

  192. How do I swipe based on the coordinates in mobile apps

  193. How do I store the location of an element in mobile apps

  194. How do I assert content description for the element in mobile apps?

  195. How do I store content description for the element in mobile apps?

Feedback and Knowledge Base