So here is the script that will find the word and if it found will highlight the word and will take the screenshot
For row=1 to DataTable.GetSheet("Action1").GetRowCount()
browser("name:=.*Google.*").Navigate(IP&DataTable("Location",dtLocalSheet))
Call Search("Date")
DataTable.SetCurrentRow(row)
Next
Function Search( Word )
Page_Content = browser("name:=.*Google.*").Page("micClass:=Page").GetROProperty("innertext")
Loc = InStr(1,Page_Content,Word,1)
If Loc > 0Then
'Word Found
DataTable("Result",dtLocalSheet)= "Found"
HighLight (Word)
Else
'Word NOT Found
DataTable("Result",dtLocalSheet) = "NOT Found"
End If
End Function
Function HighLight(word)
Dim objPage
strHighlighttext = word
Set objPage = Browser("name:=.*Google.*").Page("micClass:=Page").Object
strHTML = objPage.body.innerHTML
str = Replace(strHTML,strHighlighttext,"" & strHighlighttext & "",1,1)
objPage.body.innerHTML = str
Browser("name:=.*Google.*").Page("micClass:=Page").CaptureBitmap Environment("TestDir")&"\"&File_Name&".png",true
File_Name = File_Name +1
End Function
0 comments:
Post a Comment