forked from zoonru/puphpeteer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine puphpeteer and rialto composer packages into one repository
- Update requirements to PHP 8.3, Node 18.0, puppeteer 22 - Use relative paths for .mjs imports and no longer require node packages - Remove Frame->ExecutionContext() [Puppeteer v17] - Rename Page->createIncognitoBrowserContext() to Page->createBrowserContext() [Puppeteer v22] - Remove CDP (case-insensitve) from puppeteer classes in responses (CdpBrowser, etc) [Solves zoonru#8 and zoonru#11] - Add PHP strict_types declarations - Update phpunit to 11.3 fix tests to run
- Loading branch information
Showing
91 changed files
with
4,117 additions
and
850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use Nesk\Puphpeteer\Puppeteer; | ||
use Nesk\Rialto\Data\JsFunction; | ||
|
||
$puppeteer = new Puppeteer; | ||
$puppeteer = new Puppeteer(); | ||
|
||
$browser = $puppeteer->launch(); | ||
$page = $browser->newPage(); | ||
$page->goto('https://example.com'); | ||
$page->goto('https://example.com/'); | ||
|
||
// Get the "viewport" of the page, as reported by the page. | ||
$dimensions = $page->evaluate(JsFunction::createWithBody(/** @lang JavaScript */" | ||
return { | ||
width: document.documentElement.clientWidth, | ||
height: document.documentElement.clientHeight, | ||
deviceScaleFactor: window.devicePixelRatio | ||
}; | ||
")); | ||
$javascript = <<<'JSFUNC' | ||
/** @lang JavaScript */" | ||
return { | ||
width: document.documentElement.clientWidth, | ||
height: document.documentElement.clientHeight, | ||
deviceScaleFactor: window.devicePixelRatio | ||
}; | ||
JSFUNC; | ||
$dimensions = $page->evaluate(JsFunction::createWithBody($javascript)); | ||
|
||
printf('Dimensions: %s', print_r($dimensions, true)); | ||
|
||
$browser->close(); | ||
$browser->close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use Nesk\Puphpeteer\Puppeteer; | ||
|
||
$puppeteer = new Puppeteer; | ||
$puppeteer = new Puppeteer(); | ||
$browser = $puppeteer->launch(); | ||
|
||
$page = $browser->newPage(); | ||
$page->goto('https://example.com'); | ||
$page->goto('https://example.com/'); | ||
$page->screenshot(['path' => 'example.png']); | ||
|
||
$browser->close(); | ||
$browser->close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.