Skip to content

Add get_property for W3C / Selenium3 compatibility #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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.08 / 2018-03-21
- Add get_property for W3C / Selenium3 compatibility

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

Expand Down
23 changes: 19 additions & 4 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.08

=head1 SYNOPSIS

Expand Down Expand Up @@ -52,7 +52,7 @@ use Weasel::DriverRole;
use Moose;
with 'Weasel::DriverRole';

our $VERSION = '0.06';
our $VERSION = '0.08';


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

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

=item start

A few capabilities can be specified in t/.pherkin.yaml
Some can even be specified as environment variables, they will be expanded here if present.
Revised for Selenium3. See https://github.com/teodesian/Selenium-Remote-Driver#no-standalone-server

=cut

Expand Down Expand Up @@ -268,7 +269,21 @@ sub execute_script {
sub get_attribute {
my ($self, $id, $att) = @_;

return $self->_resolve_id($id)->get_attribute($att);
return $self->_resolve_id($id)->get_attribute($att, 1);
}

=item get_property($id, $prop_name)

With Selenium 2, the method WebElement.GetAttribute(...) returned the HTMLElement
property when present and the attribute otherwise.
The methods are separated in Selenium 3

=cut

sub get_property {
my ($self, $id, $property) = @_;

return $self->_resolve_id($id)->get_property($property);
}

=item get_page_source($fh)
Expand Down