Chrome Devtools Protocol client for PHP
Chrome Devtools Protocol client for PHP
PHP client for Chrome Devtools Protocol.
…Headless Chrome supports feature called browser contexts - they're like incognito windows - cookies, local storage etc. are not shared. After browser context is destroyed, user data created in given context, are destroyed.
Unlike incognito windows, there can be multiple isolate browser contexts at the same time.
$ctx = Context::withTimeout(Context::background(), 10);
$launcher = new Launcher();
$instance = $launcher->launch($ctx);
try {
$session = $instance->createSession($ctx);
try {
// $session implements DevtoolsClientInterface, same as returned from Tab::devtools()
} finally {
$session->close();
}
} finally {
$instance->close();
}use ChromeDevtoolsProtocol\Instance\Instance;
$instance = new Instance(/* host: */ "localhost", /* port: */ 9222);
$ctx = Context::withTimeout(Context::background(), 30 /* seconds */);
$tab = $instance->open($ctx);
$tab->activate($ctx);
$devtools = $tab->devtools();
// ...work with devtools
// no need to call ->close() as no new process is startedLicensed under MIT license. See LICENSE file.
No open issues yet, or sync has not completed.