You can read the entire text contents of any GUI object or window in your application, or the text in a specified area of the screen. You can either retrieve the text to a variable, or you can compare the retrieved text with any value you specify.
To retrieve text to a variable, use the win_get_text, obj_get_text, and get_text functions. These functions can be generated automatically, using a Insert > Get Text command, or manually, by programming. In both cases, the read text is assigned to an output variable.
To read all the text in a GUI object, you choose Insert > Get Text > From Object/Window and click an object with the mouse pointer. To read the text in an area of an object or window, you choose Insert > Get Text > From Screen Area and then use a crosshairs pointer to enclose the text in a rectangle.
In most cases, WinRunner can identify the text on GUI objects automatically. However, if you try to read text and the comment “#no text was found” is inserted into the test script, this means WinRunner was unable to identify your application font. To enable WinRunner to identify text, you must teach WinRunner your application fonts and use the image text recognition mechanism.
To compare the text in a window or object with an expected text value, use the win_check_text or obj_check_text functions.
Reading All the Text in a Window or an Object
You can read all the visible text in a window or other object using win_get_text or obj_get_text.
To read all the visible text in a window or an object:
WinRunner is minimized, the mouse pointer becomes a pointing hand, and a Help window opens.
In the case of a window, this statement has the following syntax:
win_get_text ( window, text );
The window is the name of the window. The text is an output variable that holds all of the text displayed in the window. To make your script easier to read, this text is inserted into the script as a comment when the function is recorded.
For example, if you choose Insert > Get Text > From Object/Window and click on the Windows Clock application, a statement similar to the following is recorded in your test script:
# Clock settings 10:40:46 AM 8/8/95
In the case of an object other than a window, the syntax is as follows:
obj_get_text ( object, text );
The parameters of obj_get_text are identical to those of win_get_text.
Reading the Text from an Area of an Object or a Window
The win_get_text and obj_get_text functions can be used to read text from a specified area of a window or other GUI object.
To read the text from an area of a window or an object:
WinRunner is minimized and the recording of mouse and keyboard input stops. The mouse pointer becomes a crosshairs pointer.
You can preview the string before you capture it. Press the right mouse button before you release the left mouse button. (If your mouse has three buttons, release the left mouse button after drawing the rectangle and then press the middle mouse button.) The string appears under the rectangle or in the upper left corner of the screen.
WinRunner generates a win_get_text statement with the following syntax in the test script:
win_get_text ( window, text, x1,y1,x2,y2 );
For example, if you choose Get Text > Area and use the crosshairs to enclose only the date in the Windows Clock application, a statement similar to the following is recorded in your test script:
win_get_text ("Clock", text, 38, 137, 166, 185); # 8/13/95
The window is the name of the window. The text is an output variable that holds all of the captured text. x1,y1,x2,y2 define the location from which to read text, relative to the specified window. When the function is recorded, the captured text is also inserted into the script as a comment.
The comment occupies the same number of lines in the test script as the text being read occupies on the screen. For example, if three lines of text are read, the comment will also be three lines long.
You can also read text from the screen by programming the Analog TSL function get_text into your test script.
WinRunner Related Interview Questions
|SILK TEST Interview Questions||LoadRunner Interview Questions|
|WinRunner Interview Questions||HTML Interview Questions|
|QTP Interview Questions||Manual Testing Interview Questions|
|OpenStack Interview Questions||Automation Testing Interview Questions|
|API testing Interview Questions||Rational robot Interview Questions|
|Selenium IDE Interview Questions||Performance Testing Interview Questions|
|Test Director Interview Questions|
Winrunner At A Glance
Understanding How Winrunner Identifies Gui Objects
Understanding Basic Gui Map Concepts
Working In The Global Gui Map File Mode
Editing The Gui Map
Merging Gui Map Files
Configuring The Gui Map
Learning Virtual Objects
Checking Gui Objects
Working In The Gui Map File Per Test Mode
Working With Web Objects
Working With Activex And Visual Basic Controls
Checking Powerbuilder Applications
Checking Table Contents
Creating Data-driven Tests
Synchronizing The Test Run
Defining And Using Recovery Scenarios
Handling Web Exceptions
Using Regular Expressions
Enhancing Your Test Scripts With Programming
Creating User-defined Functions
Creating Compiled Modules
Calling Functions From External Libraries
Creating Dialog Boxes For Interactive Input
Understanding Test Runs
Analyzing Test Results
Running Batch Tests
Running Tests From The Command Line
Controlling Your Test Run
Setting Properties For A Single Test
Setting Global Testing Options
Customizing The Test Script Editor
Customizing The Winrunner User Interface
Setting Testing Options From A Test Script
Customizing The Function Generator
Initializing Special Configurations
Integrating With Quicktest Professional
Managing The Testing Process
Testing Systems Under Load
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.