… | |
… | |
1105 | =item $wd->take_element_screenshot ($element) |
1105 | =item $wd->take_element_screenshot ($element) |
1106 | |
1106 | |
1107 | Similar to C<take_screenshot>, but only takes a screenshot of the bounding |
1107 | Similar to C<take_screenshot>, but only takes a screenshot of the bounding |
1108 | box of a single element. |
1108 | box of a single element. |
1109 | |
1109 | |
1110 | Note: The W3C WebDriver specification also mentions a "scroll" parameter, |
1110 | Compatibility note: As of chrome version 80, I found that the screenshot |
1111 | but it is impossible to pass parameters for this command, so it is |
1111 | scaling is often wrong (the screenshot is much smaller than the element |
1112 | czrrently left out. |
1112 | normally displays) unless chrome runs in headless mode. The spec does |
|
|
1113 | allow for any form of scaling, so this is not strictly a bug in chrome, |
|
|
1114 | but of course it diminishes trhe screenshot functionality. |
1113 | |
1115 | |
1114 | =cut |
1116 | =cut |
1115 | |
1117 | |
1116 | sub take_screenshot_ { |
1118 | sub take_screenshot_ { |
1117 | my $cb = pop; push @_, sub { $cb->($_[0], _decode_base64 $_[1]) }; |
1119 | my $cb = pop; push @_, sub { $cb->($_[0], _decode_base64 $_[1]) }; |