Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Win32::IEAutomation multiple windows problem

by imrags (Monk)
on Jan 07, 2010 at 14:11 UTC ( #816107=perlquestion: print w/ replies, xml ) Need Help??
imrags has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'm using Win32::IEAutomation to crawl through an internal website which is full of javascript
The script runs fine... till it reaches a point where it has to open a new window for Search Option
If i use my existing agent to click and open the search window, then it opens the "Search" box in the already opened website window
This is fine, but upon trying to get some details, the website wants to open the details in the parent screen.
The parent screen no longer exists as it has been overridden...
If i create a new agent to open the Search window, it still is unable to find the parent screen...
How do i ensure communication between two windows (IE)...????
Sample Code: use Win32::IEAutomation; my $url = "http://xyz.com"; my $agent = Win32::IEAutomation->new(visible=>1); $agent->gotoURL($url); my $user ="USER"; my $pwd = "PWD"; $agent->getTextBox('name:','login')->SetValue($user); $agent->getTextBox('name:','password')->SetValue($pwd); $agent->getButton('name:',"Submit")->Click(); $agent->getFrame("name:","topFrame")->getImagee('alt:', "mgmt")->Click +; ###the below is the search popup### $url2 = "http://xyz.com/abc.html?from=Search"; ##now there are 2 options for me... ##One is to continue with the $agent that already exists.. ##another is to create a new one.. ## here, i continue with the new agent $agent2 = Win32::IEAutomation->new(visible=>1); $agent2->gotoURL($url2); $agent2->getSelectList('name:','typecombo')->SelectItem('Address'); $agent2->getTextBox('name:',"searchstring)->SetValue("SEARCH_STRING"); $response = $agent->getButton('name:','global_search')->Click(); ####Seems to work till here.. $agent2->getLink('linktext:',"Search_String")->Click(); ####Tries to find the parent window and gets stuck :( ####
Raghu

Comment on Win32::IEAutomation multiple windows problem
Download Code
Re: Win32::IEAutomation multiple windows problem
by Anonymous Monk on Jan 08, 2010 at 01:02 UTC
    The parent screen no longer exists as it has been overridden...

    By what?

      If I use the same agent to go to the next URL (Search URL), then it opens the new URL in the same window as the parent (original) URL...
      Raghu
        Do not do that? Or modify the link before you ->Click();? Or use gotoURL again ->{Href}?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://816107]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-08-28 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls