Condition for a text displayed or not (Web page)

Advanced programming using WinTask scripting language

Condition for a text displayed or not (Web page)

Postby Yasir on Thu Jan 17, 2013 11:53 am

Hi,
I need to detect on a web page if a specific text is there. My code is :
StartBrowser("CH", "my url")
UsePage("Consulta")
Pause 5 secs until
Text("encontrado")
InWindow("CHROME.EXE|Chrome_RenderWidgetHostHWND|Consulta - Google Chrome|1",1)
PauseOK
MsgBox("TEXT found")
PauseFalse
MsgBox("TEXT not found")
End
EndPause
But it shows text not found whereas the text is there, what is wrong?
Yasir
 
Posts: 18
Joined: Tue Jun 21, 2005 5:18 pm

Re: Condition for a text displayed or not (Web page)

Postby TechSupport on Sat Jan 19, 2013 8:27 am

Hello,
In a browser window, you need to use the HTML descriptor, the object description which specifies it in the page. And then ExistHTMLElement WinTask function can detect if it exists or not, so such a code:
If ExistHTMLElement(P="text to search for"] then
msgbox("text there")
Else
msgbox("text not there")
EndIf

To know the HTML descriptor for text you are looking for, use Spy tool, and point the mouse on the paragraph, then click Paste, it will paste the HTML descriptor, argument for the ExistHTMElement function.

Best regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am


Return to Scripts programming

Who is online

Users browsing this forum: No registered users and 4 guests

cron