Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

language: perl
perl:
- "5.10"
- "5.12"
- "5.14"
- "5.16"
- "5.18"
- "5.20"
- "5.22"
- "5.24"

install:
- dzil authordeps --missing | cpanm --no-skip-satisfied
- dzil listdeps --author --missing | cpanm --no-skip-satisfied

script:
- dzil test --author --release
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
** 0.07 / 2017-05-26
- Add capacity to check and handle alerts

** 0.06 / 2016-10-03
- Make 'get_page_source' write info a file

Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = Weasel-Driver-Selenium2
abstract = PHP's Mink inspired multi-protocol web-testing library for Perl
version = 0.05
version = 0.07
author = Erik Huelsmann <[email protected]>
copyright_holder = Erik Huelsmann
main_module = lib/Weasel/Driver/Selenium2.pm
Expand Down
49 changes: 46 additions & 3 deletions lib/Weasel/Driver/Selenium2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Weasel::Driver::Selenium2 - Weasel driver wrapping Selenium::Remote::Driver

=head1 VERSION

0.06
0.07

=head1 SYNOPSIS

Expand Down Expand Up @@ -47,12 +47,13 @@ use warnings;
use MIME::Base64;
use Selenium::Remote::Driver;
use Time::HiRes;
use Carp qw(croak);
use Weasel::DriverRole;

use Moose;
with 'Weasel::DriverRole';

our $VERSION = '0.06';
our $VERSION = '0.07';


=head1 ATTRIBUTES
Expand Down Expand Up @@ -123,7 +124,7 @@ see L<Weasel::DriverRole>.
=cut

sub implements {
return '0.02';
return '0.03';
}

=item start
Expand Down Expand Up @@ -408,6 +409,48 @@ sub set_window_size {
$self->_set_window_size($value);
}

=item get_alert_text

Checks if there is a javascript alert/confirm/input on the screen.
Returns alert text if so.

=cut

sub get_alert_text {
my ($self) = @_;
my $alertTxt;

eval { $alertTxt = $self->_driver->get_alert_text() };

return $alertTxt;
}

=item accept_alert

Accepts the currently displayed alert dialog. Usually, this is
equivalent to clicking the 'OK' button in the dialog.

=cut

sub accept_alert {
my ($self) = @_;
$self->_driver->accept_alert;
}

=item dismiss_alert

Dismisses the currently displayed alert dialog. For comfirm()
and prompt() dialogs, this is equivalent to clicking the
'Cancel' button. For alert() dialogs, this is equivalent to
clicking the 'OK' button.

=cut

sub dismiss_alert {
my ($self) = @_;
$self->_driver->dismiss_alert;
}

=back

=cut
Expand Down