Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: How to handle a browser window that opens up during the execution of some external program commands

by tarunmudgal4u (Sexton)
on Apr 08, 2013 at 07:38 UTC ( #1027439=note: print w/ replies, xml ) Need Help??


in reply to Re: How to handle a browser window that opens up during the execution of some external program commands
in thread How to handle a browser window that opens up during the execution of some external program commands

Hi, I'm trying to use Win32-GuiTest for this problem. Below is my observation while using this module. please let me know your suggestions on this-

1. My powershell initiated browser window doesn't has any title. So, I'm using FindWindowLike with class regex. It works somehow okay but in some scenarios, this class regex matches more windows. Is there any way to get only one window handler?

2. Once I get the window handler, is there any function to select username, password text boxes and send texts into these text boxes.

below is the sample code i'm using to identify

use Win32::GuiTest qw( :ALL ); #use strict; my @whnds = FindWindowLike( undef, "^\s*\$" , "Internet Explorer_S +erver" ); if( !@whnds ){ die "Cannot find window with title/caption Symantec Endpoint P +rotection Manager\n"; }else{ print "window handle found: [@whnds]\n"; } $text = "hi"; foreach (@whnds) { set_front_win($_); $result= WMSetText( $_, $text ); SendKeys("{TAB}"); # sleep(1); SendKeys("admin"); # sleep(1); SendKeys("{TAB}"); # sleep(1); SendKeys("crt{@}123"); # sleep(1); SendKeys("{TAB}"); # sleep(1); SendKeys("{TAB}"); # sleep(1); SendKeys("{ENTER}"); sleep(1); #PushChildButton( undef, "Authorize" ); SendKeys("{ENTER}"); }


Comment on Re^2: How to handle a browser window that opens up during the execution of some external program commands
Download Code
Re^3: How to handle a browser window that opens up during the execution of some external program commands
by marto (Chancellor) on Apr 08, 2013 at 08:34 UTC

    To answer both questions see spy.pl from Win32::GuiTest::Examples. Use this tool (or something similar) to determin the window/object ID. See the other examples for using this ID to interact with them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-10-22 10:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls