Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Current »


1 - Introduction

Sometimes, some elements of the view can’t be directly found or clicked because they have no useful id, text, description or class.

You can find another element (parent or child) to access the item you are looking for by the path of the elements in the dump hierarchy of the view.

Every command of type Find put in memory the last element found. Another command which finish with LastElementFound can be used, for example you can use the clickOnLastElementFoundcommand to click on the last element found.

2 - List search commands

Find

Command

Example

Description

findByText

findByText,[TEXT]

findByText,[TEXT],[RANK]

Finds the nth element which text or content-desc contains the given selector. The element is saved as the last element found.

CASE-SENSITIVE DEFAULT RANK : 1 OPTIONAL RANK COMPATIBILITY : UNIVERSAL

findByTextExact

findByText,[EXACT-TEXT]

findByText,[EXACT-TEXT],[RANK]

Finds the nth element which text or content-desc is the exact given selector. The element is saved as the last element found.

CASE-SENSITIVE DEFAULT RANK : 1 OPTIONAL RANK COMPATIBILITY : UNIVERSAL

findById

findById,[ID]

findById,[ID],[RANK]

Finds the nth element with the id selector. The element is saved as the last element found.

DEFAULT RANK : 1 OPTIONAL RANK COMPATIBILITY : UNIVERSAL

findByClass

findById,[CLASS]

findById,[CLASS],[RANK]

Finds the nth element with the class selector. The element is saved as the last element found.

DEFAULT RANK : 1 OPTIONAL RANK COMPATIBILITY : UNIVERSAL

findParentLastElementFound

Finds the parent of the last element found. The parent is saved and replaced the last element found.

COMPATIBILITY : UNIVERSAL

findChildByClassLastElementFound

findChildByClassLastElementFound,[CLASS]

Finds the first child of the last element found using the given class as selector. The parent is saved and replaced the last element found.

COMPATIBILITY : UNIVERSAL

findChildByIndexLastElementFound

findChildByIndexLastElementFound,[RANK]

Find by index a child of the last element found. The Index matches the index in the screen dump.

DEFAULT RANK : 0 OPTIONAL RANK COMPATIBILITY : UNIVERSAL

3 - Use case

Use case 1 : Click on the second element with the same text

I want to click on the second button with the text “Découvrez”

findByText,Découvrez,2
clickOnLastElementFound

Use case 2 : Navigate to the elements of the view to find the good object

Here in the site sncf-connect, we want to directly set text on the Edit Text to fill the departure.

As we can see in the image, the field has no text, content-desc and the resource-id may be shuffle. The field has eventually a class but we decide for the example to navigate on the view to find the interesting element.

# Let's find the 'Départ' libelle
findByText,Départ

# go to the first parent
findParentLastElementFound

# go to the second parent
findParentLastElementFound

# then go to the 2th element (index 1) of the parent to find the EditText
findChildByIndexLastElementFound,1

# set the text directly
setTextLastElementFound,Paris

  • No labels