Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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:

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 = ""; 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 = ""; ##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 :( ####

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...
        Do not do that? Or modify the link before you ->Click();? Or use gotoURL again ->{Href}?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://816107]
Front-paged by Arunbear
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-06-19 01:49 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.