Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Win32::IEAutomation multiple windows problem

by imrags (Monk)
on Jan 07, 2010 at 14:11 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-03-28 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found