Skip to main content

SeeTestAutomation - GetAllValues

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

GetAllValues (String Zone, String Element, String Property)

Description

Get all the values of a certain property from all the existing elements. Possible properties are all the methods available on the Object spy for the page.

Parameters

  • Zone Select Zone of an example element.
  • Element Select identifier of an example element.
  • Property – Select the property you want to get back from all the matching elements.

Usage

Scenario: This command will be useful when you are looking to pull a certain property from all the elements on a list or table. By using an example element as a reference this command will return the property of all the other elements.

Example: In the following example we will use the demo application EriBank. We will extract the text values of all the elements in the following list of countries.

Command usage: All the rows on the list have the same ID. We are going to get the text of all rows using this ID.

Parameters: 

  • Zone - Select the example element's zone - in this case NATIVE.
  • Element - Element element's identifier. We will use an x-path query to identify a row in the table: xpath=//*[@id='countryList']/..//*[@id='rowTextView'].
  • Property - The property or method to be extracted from the elements that meet the query. In this case text. 

Results: 

 The command will returns an array string of all the rows visible on the screen:

India

USA

Iceland

Greenland

Switzerland

Norway

New Zealand

Greece

Italy

Ireland

China

Japan

France

Code Examples

Java Example

String [] strArray = client.getAllValues("NATIVE", "xpath=//*[@id='countryList']/..//*[@id='rowTextView']", "text"); 

C# Example Expand source

string [] strArray = client.GetAllValues("NATIVE", "xpath=//*[@id='countryList']/..//*[@id='rowTextView']", "text");

VBScript Example Expand source

client.GetAllValues  "NATIVE", "id=rowTextView", "text"
ListSize = Cint (client.GetLastStringArrayLength)-1
ReDim GetValue(ListSize)
For Iterator = 0 To (ListSize)  
GetValue(Iterator) = client.GetLastStringFromArray(Iterator)
Next
Report
info

Note: This is also the implementation for the command in our UFT AddOn.

Python Example Expand source

var = self.client.getAllValues("NATIVE", "xpath=//*[@id='countryList']/..//*[@id='rowTextView']", "text")

Perl Example Expand source

my @strArray = $client->getAllValues("NATIVE", "xpath=//*[\@id='countryList']/..//*[\@id='rowTextView']", "text");