Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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

Replies are listed 'Best First'.
Re^3: How to handle a browser window that opens up during the execution of some external program commands
by marto (Archbishop) 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?
[choroba]: did you copy any dependencies?
[choroba]: all XS code needs to be recompiled
[vedagiri89]: install perl5.16 in the new server and try to run appache
[hippo]: Which version of CentOS?
[vedagiri89]: how to fix: Attempt to reload DynaLoader.pm aborted
[hippo]: Ah, presumably 7 then.
[vedagiri89]: CentOS Linux release 7.0.1406 (Core)
[hippo]: How did you install libapreq2?

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2018-06-19 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (113 votes). Check out past polls.

    Notices?