You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to use Panther to take a full page screenshot using the following code, which uses document.documentElement:
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Panther\Client;
use Facebook\WebDriver\WebDriverDimension;
$client = Client::createChromeClient();
$client->request('GET', 'http://bot.sannysoft.com');
$width = $client->executeScript('return document.documentElement.scrollWidth');
$height = $client->executeScript('return document.documentElement.scrollHeight');
$size = new WebDriverDimension($width, $height);
$client->manage()->window()->setSize($size);
$client->takeScreenshot('screenshot.png');
However, I'm not sure this will always work. Is there a default way in Panther to take a full page screenshot? I found references online to using larger window dimensions, but not anything about an automatically sized screenshot.
In Chrome-PHP, it says, "You can also take a screenshot for the full-page layout (not only the viewport) using $page->getFullPageClip with attribute captureBeyondViewport = true":
I don't know if there is any sort of built in way to take a full page screenshot like that in Panther or not. Or if you have to set the width and height manually.
The text was updated successfully, but these errors were encountered:
I was able to use Panther to take a full page screenshot using the following code, which uses document.documentElement:
However, I'm not sure this will always work. Is there a default way in Panther to take a full page screenshot? I found references online to using larger window dimensions, but not anything about an automatically sized screenshot.
In Chrome-PHP, it says, "You can also take a screenshot for the full-page layout (not only the viewport) using $page->getFullPageClip with attribute captureBeyondViewport = true":
In PuPHPeteer, you can set fullPage to true:
$page->screenshot(['path' => 'example.png', 'fullPage'=> true]);
I don't know if there is any sort of built in way to take a full page screenshot like that in Panther or not. Or if you have to set the width and height manually.
The text was updated successfully, but these errors were encountered: