| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Brownie::Node; |
|
2
|
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
103
|
use strict; |
|
|
19
|
|
|
|
|
37
|
|
|
|
19
|
|
|
|
|
744
|
|
|
4
|
19
|
|
|
19
|
|
120
|
use warnings; |
|
|
19
|
|
|
|
|
37
|
|
|
|
19
|
|
|
|
|
494
|
|
|
5
|
19
|
|
|
19
|
|
93
|
use Sub::Install; |
|
|
19
|
|
|
|
|
175
|
|
|
|
19
|
|
|
|
|
222
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
620
|
use Brownie::Helpers; |
|
|
19
|
|
|
|
|
29
|
|
|
|
19
|
|
|
|
|
10765
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
305
|
|
|
305
|
1
|
1663
|
my ($class, %args) = @_; |
|
11
|
305
|
|
|
|
|
3761
|
return bless { %args }, $class; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
284
|
|
|
284
|
1
|
1616
|
sub driver { shift->{driver} } |
|
15
|
1202
|
|
|
1202
|
1
|
4455
|
sub native { shift->{native} } |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @Accessor = qw(attr text tag_name id name value type); |
|
18
|
|
|
|
|
|
|
our @Finder = qw(find all first); |
|
19
|
|
|
|
|
|
|
our @State = qw(is_displayed is_not_displayed is_selected is_not_selected is_checked is_not_checked); |
|
20
|
|
|
|
|
|
|
our @Action = qw(click set select unselect); |
|
21
|
|
|
|
|
|
|
|
|
22
|
29
|
|
|
29
|
0
|
1139
|
sub id { shift->attr('id') } |
|
23
|
117
|
|
|
117
|
0
|
849
|
sub name { shift->attr('name') } |
|
24
|
304
|
|
|
304
|
0
|
5430
|
sub type { shift->attr('type') } |
|
25
|
54
|
|
|
54
|
1
|
399
|
sub value { shift->attr('value') } |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub find { |
|
28
|
148
|
|
|
148
|
1
|
19992
|
my ($self, $locator) = @_; |
|
29
|
148
|
|
|
|
|
691
|
return $self->driver->find($locator, base => $self); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
*first = \&find; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub all { |
|
34
|
6
|
|
|
6
|
1
|
8995
|
my ($self, $locator) = @_; |
|
35
|
6
|
|
|
|
|
28
|
my @children = $self->driver->all($locator, base => $self); |
|
36
|
6
|
100
|
|
|
|
87
|
return @children ? @children : (); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
1
|
0
|
sub is_not_displayed { !shift->is_displayed } |
|
40
|
0
|
|
|
0
|
1
|
0
|
sub is_not_selected { !shift->is_selected } |
|
41
|
2
|
|
|
2
|
1
|
11
|
sub is_not_checked { !shift->is_checked } |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
our @Method = (@Accessor, @Finder, @State, @Action); |
|
44
|
|
|
|
|
|
|
for (@Method) { |
|
45
|
|
|
|
|
|
|
next if __PACKAGE__->can($_); |
|
46
|
|
|
|
|
|
|
Sub::Install::install_sub({ |
|
47
|
|
|
|
|
|
|
code => Brownie::Helpers->can('not_implemented'), |
|
48
|
|
|
|
|
|
|
as => $_, |
|
49
|
|
|
|
|
|
|
}); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NAME |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Brownie::Node - base class of Brownie::Node series |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * C |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Returns a new instance. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $node = Brownie::Node->new(%args); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
C<%args> are: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 8 |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * C: parent Brownie::Driver instance |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * C: native driver specific node representation instance |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * C |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns a driver instance. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $driver = $node->driver; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * C |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns a native node instance. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $native = $node->native; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * C |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Returns an attribute value. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $title = $node->attr('title'); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * C |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Returns the value of element. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $value = $node->value; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item * C |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns a child node text. (= innerText) |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $text = $node->text; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * C |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Returns a tag name. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $tag_name = $node->tag_name; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * C, C |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Whether this element is displayed, or not. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
if ($node->is_displayed) { |
|
119
|
|
|
|
|
|
|
print "this node is visible"; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
if ($node->is_not_displayed) { |
|
123
|
|
|
|
|
|
|
warn "this node is not visible"; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * C, C |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Whether this element is checked, or not. (checkbox) |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
if ($checkbox->is_checked) { |
|
131
|
|
|
|
|
|
|
print "marked"; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
if ($checkbox->is_not_checked) { |
|
135
|
|
|
|
|
|
|
warn "unmarked..."; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * C, C |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Whether this element is selected, or not. (radio, option) |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
if ($radio->is_selected) { |
|
143
|
|
|
|
|
|
|
print "this radio button is selcted"; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
if ($option->is_not_selected) { |
|
147
|
|
|
|
|
|
|
warn "this option element is not selected"; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * C |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Sets value to this element. (input, textarea) |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
$input->set($value); |
|
155
|
|
|
|
|
|
|
$textarea->set($text); |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * C |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Select this element (option, radio) |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$option->select; |
|
162
|
|
|
|
|
|
|
$radio->select; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * C |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Unselect this element (options - multiple select) |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
$option->unselect; |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item * C |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Clicks this element. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
$link->click; |
|
175
|
|
|
|
|
|
|
$button->click; |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * C |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Finds and returns an located element under this. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
my $element = $node->find($locator); # search under $node |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * C |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Finds and returns located elements under this. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
my @elements = $node->all($locator); # search under $node |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=back |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 AUTHOR |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
NAKAGAWA Masaki Emasaki@cpan.orgE |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 LICENSE |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
198
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
L |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |