File Coverage

blib/lib/Selenium/Client/WebElement.pm
Criterion Covered Total %
statement 18 64 28.1
branch 0 2 0.0
condition 0 9 0.0
subroutine 6 13 46.1
pod 3 5 60.0
total 27 93 29.0


line stmt bran cond sub pod time code
1             package Selenium::Client::WebElement;
2             $Selenium::Client::WebElement::VERSION = '2.01';
3             # ABSTRACT: Representation of an HTML Element used by Selenium Client Driver
4              
5 2     2   176854 use strict;
  2         6  
  2         138  
6 2     2   13 use warnings;
  2         4  
  2         154  
7              
8 2     2   13 use parent qw{Selenium::Remote::WebElement};
  2         4  
  2         16  
9              
10 2     2   65026 no warnings qw{experimental};
  2         5  
  2         113  
11 2     2   14 use feature qw{signatures};
  2         3  
  2         337  
12              
13 2     2   709 use Carp::Always;
  2         1256  
  2         14  
14              
15              
16 0     0     sub _param ( $self, $default, $param, $value = undef ) {
  0            
  0            
  0            
  0            
  0            
17 0   0       $self->{$param} //= $default;
18 0 0         $self->{$param} = $value if defined $value;
19 0           return $self->{$param};
20             }
21              
22 0     0 0   sub element ( $self, $element = undef ) {
  0            
  0            
  0            
23 0           return $self->_param( undef, 'element', $element );
24             }
25              
26 0     0 1   sub driver ( $self, $driver = undef ) {
  0            
  0            
  0            
27 0           return $self->_param( undef, 'driver', $driver );
28             }
29              
30 0     0 0   sub session ( $self, $session = undef ) {
  0            
  0            
  0            
31 0           return $self->_param( undef, 'session', $session );
32             }
33              
34 0     0 1   sub new ( $class, %options ) {
  0            
  0            
  0            
35 0           my $self = bless( $options{id}, $class );
36 0           $self->id( $self->{elementid} );
37 0           $self->driver( $options{driver} );
38 0           $self->session( $options{driver}->session );
39 0           return $self;
40             }
41              
42 0     0 1   sub id ( $self, $value = undef ) {
  0            
  0            
  0            
43 0           return $self->_param( undef, 'id', $value );
44             }
45              
46             # We need to inject the element ID due to this nonstandard wrapper.
47 0     0     sub _execute_command ( $self, $res, $params = {} ) {
  0            
  0            
  0            
  0            
48              
49             #XXX sigh, some day spec authors will stop LYING
50 0   0       $params->{propertyname} //= delete $params->{property_name} // delete $res->{property_name};
      0        
51              
52 0           my $params_modified = {
53             %$params,
54             elementid => $self->id,
55             };
56 0           return $self->driver->_execute_command( $res, $params_modified );
57             }
58              
59             1;
60              
61             __END__
62              
63             =pod
64              
65             =encoding UTF-8
66              
67             =head1 NAME
68              
69             Selenium::Client::WebElement - Representation of an HTML Element used by Selenium Client Driver
70              
71             =head1 VERSION
72              
73             version 2.01
74              
75             =head1 DESCRIPTION
76              
77             Subclass of Selenium::Remote::WebElement.
78              
79             Implements the bare minimum to shim in Selenium::Client as a backend for talking to selenium 4 servers.
80              
81             See the documentation for L<Selenium::Remote::WebElement> for details about methods, unless otherwise noted below.
82              
83             =head1 SEE ALSO
84              
85             Please see those modules/websites for more information related to this module.
86              
87             =over 4
88              
89             =item *
90              
91             L<Selenium::Client|Selenium::Client>
92              
93             =back
94              
95             =head1 BUGS
96              
97             Please report any bugs or feature requests on the bugtracker website
98             L<https://github.com/troglodyne-internet-widgets/selenium-client-perl/issues>
99              
100             When submitting a bug or request, please include a test-file or a
101             patch to an existing test-file that illustrates the bug or desired
102             feature.
103              
104             =head1 AUTHORS
105              
106             Current Maintainers:
107              
108             =over 4
109              
110             =item *
111              
112             George S. Baugh <george@troglodyne.net>
113              
114             =back
115              
116             =head1 COPYRIGHT AND LICENSE
117              
118             Copyright (c) 2024 Troglodyne LLC
119              
120              
121             Permission is hereby granted, free of charge, to any person obtaining a copy
122             of this software and associated documentation files (the "Software"), to deal
123             in the Software without restriction, including without limitation the rights
124             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125             copies of the Software, and to permit persons to whom the Software is
126             furnished to do so, subject to the following conditions:
127             The above copyright notice and this permission notice shall be included in all
128             copies or substantial portions of the Software.
129             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
130             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
132             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
133             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
134             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
135             SOFTWARE.
136              
137             =cut