… | |
… | |
1076 | |
1076 | |
1077 | =cut |
1077 | =cut |
1078 | |
1078 | |
1079 | =item $wd->take_screenshot |
1079 | =item $wd->take_screenshot |
1080 | |
1080 | |
1081 | Create a screenshot, returning it as a PNG image in a C<data:> URL. |
1081 | Create a screenshot, returning it as a PNG image encoded as base64. To |
|
|
1082 | decode 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 | |
1085 | Similar to C<take_screenshot>, but only takes a screenshot of the bounding |
1094 | Similar to C<take_screenshot>, but only takes a screenshot of the bounding |
1086 | box of a single element. |
1095 | box of a single element. |
|
|
1096 | |
|
|
1097 | Note: The W3C WebDriver specification also mentions a "scroll" parameter, |
|
|
1098 | but there is no way to specify it according to the spec, so it is |
|
|
1099 | currently left out. |
1087 | |
1100 | |
1088 | =cut |
1101 | =cut |
1089 | |
1102 | |
1090 | sub take_screenshot_ { |
1103 | sub 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 | |
1358 | Moves a pointer to the given position, relative to origin (either |
1371 | Moves 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 |
|
|
1373 | truncated to integer values. |
1360 | |
1374 | |
1361 | =cut |
1375 | =cut |
1362 | |
1376 | |
1363 | sub move { |
1377 | sub 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 | |
1372 | Executes a pointer cancel action. |
1386 | Executes a pointer cancel action. |