ElementListSelect (ListLocator, ElementLocator, Index, Click)
Note: This command will work only after application preparation .
|
|
|
|
Select an element within a list (first making the element visible)
ListLocator: List locator
ElementLocator: Element locator (NOTE: this variable does not support XPath queries)
Index: Element index
Click: If TRUE then click once found
Scenario: In the following example we will use the EriBank application to select an element from the country list.
Step 1: Login to the EriBank application.
Step 2: Click the Make Payment button.
Step 3: Click Select button.
The country list will be displayed on the screen.
Step 4: Set the elementListSelect command properties.
How to find the list locator Native properties?
Usually it can be found behind its components properties:
Click on one of the list's components.
Right-click on the component then click on 'Ignore' - this will remove its properties from the screen, and will let you see what's behind it.
Click again in the same place - You will climb up the tree hierarchy of components.
We have found the list locator identifier. We will use accessibilityLabel=conutryView as the identifier.
Note the icon on the tree hierarchy for the list/table which you can use to get the table property.
Step 5: Get the Element's Native id (The option you want to pick on the list)
In this example we will search for Brazil
Command's properties:
To find what we are looking for.
ListLocator: “accessibilityLabel=conutryView”
ElementLocator: “text=Brazil”
Index: “0”
Click: “TRUE”
It will now select 'Brazil' (If you do not want to click on it, just set the Click property to False).
Command is available on all code languages: UFT (QTP), TestComplete, RFT, C#, Python, Perl, etc.
client.elementListSelect("accessibilityLabel=conutryView","text=Brazil", 0, true)client.elementListSelect("accessibilityLabel=conutryView", "text=Brazil", 0, true)client.elementListSelect"accessibilityLabel=conutryView", "text=Brazil", 0, trueReportself.client.elementListSelect("accessibilityLabel=conutryView", "text=Brazil", 0, True)$client->elementListSelect("accessibilityLabel=conutryView","text=Brazil", 0, 1)