Thursday, June 12, 2008

VisualTest - Functions by web Tag

Visual Test has the flexibility to click the web objects by the tag. Even you can verify whether the tag exists or not in the web page. Below I've given code snippets to use tag related functions.

VisualTest code : Click based on the given tag details.

'------------------- ' Method : WebClickTag ' Author : T.Palani Selvam ' Purpose : Click based on the given tag. It is useful to nonform tags. ' Parameters: sContext - String, contains web context value. ' sForm - String, contains part of title. ' sTag - String, contains tag data. ' sTagType - String, type of tag to be processed. ' Returns : Returns Integer, either TRUE or FALSE ' Caller : ' Calls : - Nil - '----------------------- Function WebClickTag (sContext As String, sForm As String, sTagType As String, sTag As String) AS Integer WebClickTag = FALSE If WebTagExists(sContext, sTag, sTagType) Then WebTagClick(sContext, sTag, sTagType) LogWrite("Successfully Clicked tag: " + sTagType, 1) WebClickTag = TRUE Else LogWrite("Failure to Click tag: " + sTagType, 1) End IF End Sub


Visual Test code: Check object exists based on the given tag
'--------------------- ' Method : WebTagCheck ' Author : T.Palani Selvam ' Purpose : Check objectexists based on the given tag. It is useful to nonform tags. ' Parameters: sContext - String, contains web context value. ' sForm - String, contains part of title. ' sTag - String, contains tag data. ' sTagType - String, type of tag to be processed. ' Returns : Returns Integer, either TRUE or FALSE ' Caller : ' Calls : - Nil - '--------------------- Function WebTagCheck (sContext As String, sForm As String, sTagType As String, sTag As String) AS Integer WebTagCheck = FALSE If WebTagExists(sContext, sTag, sTagType) Then LogWrite("Successfully Checked tag: " + sTagType, 1) WebTagCheck = TRUE Else LogWrite("Failure to Click tag: " + sTagType, 1) End IF End Sub

2 comments:

neetu said...

Thanks for sharing the code to use tag related functions. But i wish if you could provide with little explanation too with the code or comments that will help to define the terms used. Software Testing Services

Palani Selvam said...

Neetu,
Comments are given already. All function and variable names are self explanatory.

I didn't provide the example, as user can easily understand the purpose of the functions.