Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

WWW Selenium popup windows

by mmittiga17 (Scribe)
on May 19, 2012 at 14:09 UTC ( #971418=perlquestion: print w/replies, xml ) Need Help??
mmittiga17 has asked for the wisdom of the Perl Monks concerning the following question:

Good morning All, I have been searching and searching for a way to access a popup window using Perl's WWW::Selenium module. After I click a link the popup opens and select values and then click submit. I am trying to automate this with selenium but I am not having my luck. After my code launches the popup my script dies after trying to access popup. I have tried to use the ide and then play back but it does not get the popup either. Can someone point me in the right direction. I have read the docs on cpan and have searched this site as well. Thanks in advance.

Code snipet for the popup.
$sel->open("javascript:openMdlWindow('ActivityDetail_Options.aspx', '7 +00', '600')"); $sel->set_timeout($timeout); print $sel->get_all_window_ids(),"\n"; $sel->select_pop_up("Activity Detail Report Options"); $sel->set_timeout($timeout); $sel->type("TempBeginDay", "16"); $sel->type("BeginDay", "16"); $sel->type("TempEndDay", "16"); $sel->type("EndDay", "16"); $sel->click("btnSubmit"); $sel->set_timeout($timeout);

Replies are listed 'Best First'.
Re: WWW Selenium popup windows
by Anonymous Monk on May 19, 2012 at 17:10 UTC

      Thanks I found the solution on the link you provided.

      # Assumes only 1 currently opened window with target _blank sub select_target_blank_window { my ($self, $timeout) = @_; my $window_name; for (1 .. $timeout / 100) { ($window_name) = grep {/selenium_blank\d+/} $self->get_all_wind +ow_names; last if defined $window_name; $self->pause(100); } croak "Timed out waiting to select blank target window" if ! defin +ed $window_name; return $self->select_window($window_name); }

      Now to figure out how to get a value in a form. It is a drop down list consisting dates. sel->type("xxx",15"); does not work. nor does

      <code> $sel->get_eval('document.actForm.TempBeginDay.value = "15"'); $sel->get_eval('document.actForm.TempEndDay.value = "15"'); <\code> Thoughts??? Thanks!!!!

        Thoughts???

        Use the selenium GUI to record clicks etc

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://971418]
Approved by Eliya
help
Chatterbox?
[james28909]: check if it is a hash or an array ect with ref in one sub.
[james28909]: like all the subs calling get_data get_array get_ect, you could just use get_data. once you send the data to get_data, check if it is a hash or an array ect. and do functions for each, in one sub
[james28909]: that looks like it would be alot more work than just renaming the sub though lol
[Lady_Aleena]: james28909, did you even look at the subs?
[james28909]: yes
[Lady_Aleena]: And you see how the first two are vastly different than the third, right?

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-05-24 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?