ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-WebDriver/WebDriver.pm
(Generate patch)

Comparing AnyEvent-WebDriver/WebDriver.pm (file contents):
Revision 1.49 by root, Thu Mar 26 18:49:09 2020 UTC vs.
Revision 1.50 by root, Thu Mar 26 21:28:18 2020 UTC

1076 1076
1077=cut 1077=cut
1078 1078
1079=item $wd->take_screenshot 1079=item $wd->take_screenshot
1080 1080
1081Create a screenshot, returning it as a PNG image in a C<data:> URL. 1081Create a screenshot, returning it as a PNG image encoded as base64. To
1082decode and save, you coulöd do something like:
1083
1084 use MIME::Base64 ();
1085
1086 my $screenshot = $wd->take_screenshot;
1087
1088 open my $fh, ">", "screenshot.png" or die "screenshot.png: $!\n";
1089
1090 syswrite $fh, MIME::Base64::decode_base64 $screenshot;
1082 1091
1083=item $wd->take_element_screenshot ($element) 1092=item $wd->take_element_screenshot ($element)
1084 1093
1085Similar to C<take_screenshot>, but only takes a screenshot of the bounding 1094Similar to C<take_screenshot>, but only takes a screenshot of the bounding
1086box of a single element. 1095box of a single element.
1096
1097Note: The W3C WebDriver specification also mentions a "scroll" parameter,
1098but there is no way to specify it according to the spec, so it is
1099currently left out.
1087 1100
1088=cut 1101=cut
1089 1102
1090sub take_screenshot_ { 1103sub take_screenshot_ {
1091 $_[0]->get_ (screenshot => $_[1]); 1104 $_[0]->get_ (screenshot => $_[1]);
1351 $self 1364 $self
1352 ->click ($button, $source) 1365 ->click ($button, $source)
1353 ->click ($button) 1366 ->click ($button)
1354} 1367}
1355 1368
1356=item $al = $al->move ($button, $origin, $x, $y, $duration, $source) 1369=item $al = $al->move ($origin, $x, $y, $duration, $source)
1357 1370
1358Moves a pointer to the given position, relative to origin (either 1371Moves a pointer to the given position, relative to origin (either
1359"viewport", "pointer" or an element object. 1372"viewport", "pointer" or an element object. The coordinates will be
1373truncated to integer values.
1360 1374
1361=cut 1375=cut
1362 1376
1363sub move { 1377sub move {
1364 my ($self, $origin, $x, $y, $duration, $source) = @_; 1378 my ($self, $origin, $x, $y, $duration, $source) = @_;
1365 1379
1366 $self->_add ($source, ptr => pointerMove => 1380 $self->_add ($source, ptr => pointerMove =>
1367 origin => $origin, x => $x*1, y => $y*1, duration => $duration*1) 1381 origin => $origin, x => int $x*1, y => int $y*1, duration => $duration*1)
1368} 1382}
1369 1383
1370=item $al = $al->cancel ($source) 1384=item $al = $al->cancel ($source)
1371 1385
1372Executes a pointer cancel action. 1386Executes a pointer cancel action.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines