Text Area Check point

It is used for checking the text present in the specified area.

Navigation:

Keep the tool under record mode -> Insert menu ->check point -> Text area check point -> Select the desired text by using cross hair icon ->Click OK -> Select any options like Match case, Ignore spaces, Exact Match, Text not displayed -> Click OK

Coding Text area check point:

Script:
Ex: In Note Pad       
There is a QTP class
There is no prerequisite
There is a monitor

Now identify whether “is” exists between “class” and “no”

Option Explicit
Dim foundTxt, startPos, endPos
Dim substr, actualtxtpos

foundTxt=window("Notepad").WinEditor("Edit").GetVisibleText()

startPos=InStr(foundTxt,"class")
endPos=InStr(foundTxt,"no")

substr=mid(foundTxt,startPos,endPos + len(“no”))

actualtxtpos=InStr(substr,"is")
If  actualtxtpos<>0 Then
    Reporter.ReportEvent micPass,"text should be displayed","Text is displayed"
Else
    Reporter.ReportEvent micFail,"text should be displayed","Text is not displayed"
End If

Script: Write a script to extract file name, file path and drive letter

Option Explicit
Dim filePath,firstloc,driveName
Dim filePathVal,secondloc,filename
filePath=”D:\Vamsi\Test data\sample.xls”
    firstloc=Instr(filePath,"\")
driveName=mid(filePath,1,firstloc-2)
msgbox driveName
secondloc=InstrRev(filePath,"\")
filePathVal=mid(filePath,firstLoc+1,secondLoc-4)
msgbox filePathVal
fileName=mid(filePath,secondLoc+1,len(filePath)-secondLoc)
msgbox fileName

Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com