Answer the question
In order to leave comments, you need to log in
HeadlessChromium for php how to make click?
I use the HeadlessChromium library for php, tell me how to make click through xpath.
I bring my code
require_once('vendor/autoload.php');
use HeadlessChromium\BrowserFactory;
use HeadlessChromium\Input\Mouse;
use HeadlessChromium\Communication\Connection;
use HeadlessChromium\Communication\Message;
$browserFactory = new BrowserFactory("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
// starts headless chrome
$browser = $browserFactory->createBrowser([
'headless' => true, // disable headless mode
'windowSize' => [663, 558],
'enableImages' => false,
'sendSyncDefaultTimeout' => 30000000,
'mouse' => true // will enable verbose mode
]);
$page = $browser->createPage();
$uri = 'https://saite.ru';
$page->navigate($uri)->waitForNavigation();
$pageTitle = $page->evaluate('document.title')->getReturnValue();
echo $pageTitle;
$evaluation = $page->evaluate('document.documentElement.innerHTML')->getReturnValue();
echo $evaluation;
Answer the question
In order to leave comments, you need to log in
Judging by the sorts of the Page class, there is no way, but you can try creating click events on elements through javascript and run this code through $page->evaluate. Google for "javascript fire click event"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question