# 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_window_names; last if defined $window_name; $self->pause(100); } croak "Timed out waiting to select blank target window" if ! defined $window_name; return $self->select_window($window_name); }