saran_techie has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I would like to know how could the error indicators be captured through perl scripting. To be more clear on this question, let's assume, there's a textbox in a web application. It shall accept only numerals, but 'characters' have been keyed in as input for the field and tab key has been pressed. There's an error indicator appeared besides the textbox. On mouse over, the tool tip shows the error message "Characters are not accepted". My question is how to get that error message through perl.

Regards,
Saravanan.S

Replies are listed 'Best First'.
Re: How to capture error indicators
by grizzley (Chaplain) on Feb 27, 2009 at 10:17 UTC

    Finding the answere is harder than I though... but interesting.

    I searched a few web pages to get any baloon example (not found any), and then started trying normal applications, like Windows Character Map. Maybe this will help you in any way.

    My main though is that balloon is a window like any other window - find its handle and you'll get the content.

    This description + Wind32::GuiTest::Examples was the base. You can find there spy.pl complete and working example. I only added sleep 2 before loop and after running script (output redirected to file), I moved mouse over Total commander icon. On the result list, there appeared line

    +          66316     , 'TTOTAL_CMD               ', 0         , Rect:58 ,73 ,1199,938   'Total Commander 6.54 - RTS Networks Sp. z o.o.'

    where the last string was my balloon text. Similar test with quick launch icons didn't succeed. TaskBar icon's balloon worked like, too, and this is example output from some button's tooltip in application itself:

    Depth WindowID , 'ClassName ', ParentID , Rect:W +indowRect, , , 'WindowText' 0 , ' ', n/a , Rect:n +/a, , , '' ------------------ + 4326422 , 'TToolTip ', 0 , Rect:3 +15,150,355,167 'Pack...'

    where 'Pack...' was the balloon text.

    I didn't manage to achieve the same results with win 'Character Map' application, it seems that success depends strongly on how the application was written.

    GuiTest modules have possibility to move mouse programmatically, so you could try to combine this all together. I hope there is easier way and anyone has better advice for you.

Re: How to capture error indicators
by Jenda (Abbot) on Feb 27, 2009 at 14:21 UTC

    The only thing that comes to mind is Win32::IE::Mechanize. You might be able to check the HTML as it gets modified by the JavaScript implementing the validation. But it's gonna be quite hard and it's gonna be strictly for this single web app. 'Cause other apps will report the errors differently.

    Why are you trying to do this?

Re: How to capture error indicators
by Anonymous Monk on Feb 27, 2009 at 09:21 UTC
    Substitute saran_techie for perl; does your question still make sense? It becomes: How to get that error message through saran_techie? Assuming saran_techie is human, the answer is communicate with saran_techie. Understand?
    A reply falls below the community's threshold of quality. You may see it by logging in.