Skip to main content

SeeTestAutomation- ElementGetText

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 .

ElementGetText**(**Zone, Element, Index)

Description

Get text from element - The text will be saved as a string.

Parameters

Usage

Scenario: We will use the Eribank demo application.

After selecting the country from the country list using the elementListSelect command, we would want to confirm that the text on the Country text field is indeed what we choose.

The command to run

The result (from the console log)

info

By default elementGetText will return the first 255 characters. To change the default text length use the command setProperty with name of the property "max.text.size". For example:

client.setProperty("max.string.size", "500");

Code Examples

Java Example

String str0 = client.elementGetText("NATIVE", "xpath=//*[@id='countryTextField']", 0);

C# Example Expand source

String str0 = client.elementGetText("NATIVE", "xpath=//*[@id='countryTextField']", 0);

VBScript Example Expand source

str0 = client.ElementGetText ( "NATIVE", "xpath=//*[@id='countryTextField']", 0 )
Report

Python Example Expand source

var0 = self.client.elementGetText("NATIVE", "xpath=//*[@id='countryTextField']", 0)

Perl Example Expand source

my $str0 = $client->elementGetText("NATIVE", "xpath=//*[\@id='countryTextField']", 0);