Forum Discussion
velise
12 years agoOccasional Contributor
here is how i test my code :
1) I open iexplore
2) Manually open http://www.google.fr
3) Once page is loaded i run my script :
Sub Find_Str_Body
Dim url, browser, page, body, str
url = "http://www.google.fr"
strBrowser = "iexplore"
str = "Recherche"
Set browser = Sys.Process(strBrowser)
Set page = browser.Page(url)
If LCase(browser.ProcessName) = "iexplore" Then
Set body = page.Application.Document.body
if(aqObject.CheckProperty(body, "innerText", cmpContains, str, False) ) then
Log.Message("Texte trouve")
else
Log.Message("Texte non trouve")
end if
Else ' Firefox & Chrome
Set body = page.contentDocument.body
if( aqObject.CheckProperty(body, "textContent", cmpContains, str, False) ) then
Log.Message("Texte trouve")
else
Log.Message("Texte non trouve")
end if
End If
End Sub
4) i haver the error :
Unable to find the object Page(http://www.google.fr). See Additional Information for details. 12:11:04 Normal
on line Set page = browser.Page(url)
1) I open iexplore
2) Manually open http://www.google.fr
3) Once page is loaded i run my script :
Sub Find_Str_Body
Dim url, browser, page, body, str
url = "http://www.google.fr"
strBrowser = "iexplore"
str = "Recherche"
Set browser = Sys.Process(strBrowser)
Set page = browser.Page(url)
If LCase(browser.ProcessName) = "iexplore" Then
Set body = page.Application.Document.body
if(aqObject.CheckProperty(body, "innerText", cmpContains, str, False) ) then
Log.Message("Texte trouve")
else
Log.Message("Texte non trouve")
end if
Else ' Firefox & Chrome
Set body = page.contentDocument.body
if( aqObject.CheckProperty(body, "textContent", cmpContains, str, False) ) then
Log.Message("Texte trouve")
else
Log.Message("Texte non trouve")
end if
End If
End Sub
4) i haver the error :
Unable to find the object Page(http://www.google.fr). See Additional Information for details. 12:11:04 Normal
on line Set page = browser.Page(url)