Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description: This command is used to retrieve a value from any element on the browser screen and store it in a variable. The default setting allows it to capture a text (HTML tag - Text), but you can also capture other HTML Tags, CSS properties, numbers, strings or boolean values.


Usage Scenarios

HTML Tag with attributes

(Scenario 1) Suppose we want to retrieve the text value from the Birthday text box on our Reference app which is found on the Edit Profile page and assign it to a variable.

...

See the Test Library path:subject7_samples/subject7_advanced_suite/subject7_modify_profile_information

The following video demonstrates how the “Birthday” text box value is retrieved as part of execution of “subject7_modify_profile_information” test case in “subject7_samples” folder. Since the original value is empty, a random one has been entered to simulate this test.

...

Code Block
WEB GOTO_URL ${subject7_reference_environment.url} HALT ON ERROR 
CALL FUNCTION subject7_reference_login HALT ON ERROR 
WAIT 2 HALT ON ERROR 
WEB CLICK TARGET LOCATOR subject7_reference_general.link.profile HALT ON ERROR 
WEB CLICK TARGET LOCATOR subject7_reference_main_page.link.profile_settings HALT ON ERROR 
WEB VALUE_GET RESULT_VARIABLE image_src SOURCE ELEMENT XPATH "//text()[contains(.,'profile')]/ancestor::div/descendant::img" ALIAS "" XML_TYPE "{http://www.w3.org/1999/XSL/Transform}NODE" ATTRIBUTE "src" HALT ON ERROR

...

CSS with Attributes

(Scenario 4) Suppose we want to retrieve font size of a post under a profile on Reference app and assign it to a variable.

...

Code Block
WEB GOTO_URL ${subject7_reference_environment.url} HALT ON ERROR 
CALL FUNCTION subject7_reference_login HALT ON ERROR 
WEB CLICK TARGET LOCATOR subject7_reference_general.link.profile HALT ON ERROR 
WEB CLICK TARGET LOCATOR subject7_reference_main_page.link.profile_settings HALT ON ERROR 
WAIT 1 HALT ON ERROR 
WEB VALUE_GET RESULT_VARIABLE font_size SOURCE LOCATOR subject7_reference_posts.cell.existing_post XML_TYPE "CSS" ATTRIBUTE "font-size" HALT ON ERROR

...

Numbers

(Scenario 5) Suppose we have a post containing only numbers in Reference app and we want to retrieve the number and assign it to a variable.

...

Web Locator:

...

Inline XPath:

...

and all of your steps should look like this:

...

See the video below that demonstrates this scenario. You can also use the snippet below in Advanced View to test it:

Code Block
WEB GOTO_URL ${subject7_reference_environment.url} HALT ON ERROR 
CALL FUNCTION subject7_reference_login HALT ON ERROR 
WEB CLICK TARGET LOCATOR subject7_reference_general.link.profile HALT ON ERROR 
WEB CLICK TARGET LOCATOR subject7_reference_main_page.link.profile_settings HALT ON ERROR 
WAIT 1 HALT ON ERROR 
WEB VALUE_GET RESULT_VARIABLE get_number SOURCE LOCATOR subject7_reference_posts.celldiv.existing_postposts XML_TYPE "{http://www.w3.org/1999/XSL/Transform}NUMBERNODE" ATTRIBUTE "TEXT" HALT ON ERROR

...

Strings

(Scenario 6) Suppose we have a post containing a string in Reference app and we want to retrieve the string and assign it to a variable.

...

Web Locator:

...

Inline XPath:

...

and all our steps should look like this:

...

See the video below that demonstrates this scenario.

...

Boolean

(Scenario 7) Suppose we have a post containing text in Reference app and we want to use Get_Web_Value with Boolean to see if the text is found or not by returning a “true” or “false” value.

...

Web Locator:

...

Inline XPath:

...

and all our steps should look like this:

...

See the video below that demonstrates this scenario:

...

Javascript

(Scenario 1) Suppose we want to retrieve the number value from a string using Javascript/RegEx and store it in a value.

...