web_image_check

Verifies the presence of a specified image inside an HTML page.

C Language

int web_image_check( const char *CheckName, <List of Attributes>, <"Alt=alt"|| "Src=src">, LAST);

Java Language

int object.image_check( String CheckName, String [] argumentList );
Argument
Description
object
An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
CheckName
The name of the image check, as it appears in the test tree.
List of Attributes
Supported Attribute:
Frame: Defines the scope of the search in the case of multiple frames.
Supported Options:
Options are similar to attributes, but some of them allow only a pre–defined set of values. All other values are illegal.
The allowed options are: expect, matchcase, repeat, report, and onfailure. See Supported Options below.
Alt
Checks for the ALT tag of the image. Empty Alt strings are illegal.
Src
Checks for the SRC tag of the image. Empty Src strings are illegal.
LAST
A marker that indicates the end of the field list.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

The following argument(s) can be parameterized using standard parameterization: List of Attributes, Alt, Src

Supported Options

expect

Defines that the check is successful if the script:

  • Finds the specified search criteria.

– or –

  • Does not find the specified search criteria.

For example, you may want to check that a specific error message does not appear on your web page.

Legal values:

found
Indicates that the check is successful if the script finds the specified search criteria.
notfound
Indicates that the check is successful if the scriptdoes not find the specified search criteria.

Default: found

Matchcase

The matchcase option defines whether the search is case–sensitive or not.

repeat

Defines whether the search should be continued after the first appearance of the search string is located. This option is useful when searching through a web page that may have multiple occurrences of the search string.

Legal values:

yes
Indicates that the search should be continued after the first appearance of the search string is located.
no
Indicates that the search should not be continued after the first appearance of the search string is located.

Default: yes

report

Defines under what conditions VuGen displays the results of the checks in the Result Summary Report.

Legal values:

success
Displays check results only if the check succeeds.
failure
Displays check results only if the check fails.
always
Displays all check results irrespective of the outcome of the check.

The default is always.

onfailure

Determines whether the script instance should abort if the check fails.

Legal values:

abort
Indicates that the script should abort if the check fails, regardless of the error–handling method set in the runtime settings.

If Onfailure=abort is not specified, then the state of Continue on Error will determine what will happen in the event of a web_find step failing to find a text. See Error Handling for more information.

General Information

The web_image_check function verifies the presence of a specified image inside an HTML page.

Either Alt or Src, or both, must be in the argument list. If both are passed, the check passes if both match a single image element.

This function is only supported for HTML–based scripts.