Z
Z
Zimaell2019-08-19 10:47:54
PHP
Zimaell, 2019-08-19 10:47:54

How to pass the headless browser check?

found a service that determines if the browser is real
https://intoli.com/blog/not-possible-to-block-chro...
When I log in from a regular browser

Test Name Result
User Agent (Old) Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
WebDriver (New) missing (passed)
Chrome (New) missing (failed)
Permissions (New) denied
Plugins Length (Old) 1
Languages ​​(Old) ru-RU,ru,en-US,en

when with a phantom
Test Name Result
User Agent (Old)
WebDriver (New) present (failed)
Chrome (New) missing (failed)
Permissions (New)
Plugins Length (Old)
Languages ​​(Old)

It seems to me that the main parameter WebDriver (New) is missing (passed) or present (failed), and for some reason the user agent does not show.
Is it possible to specify the settings somewhere in the phantom so that this check can be passed?
The code itself is
$browserObj=\MTS\Factories::getDevices()->getLocalHost()->getBrowser('phantomjs');
$browserObj->setKeepalive(true);
$windowObj=$browserObj->getNewWindow();
$windowObj->setUserAgent('Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0');
$windowObj->setUrl('https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html');
$content=$windowObj->getDom();
echo $content;
$browserObj->terminate();

Tried Puppeteer
use Nesk\Puphpeteer\Puppeteer;
use Nesk\Rialto\Data\JsFunction;
use Nesk\Rialto\Exceptions\Node;
$puppeteer = new Puppeteer;
$browser = $puppeteer->launch([
  'headless=false',
    'args' => [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-dev-shm-usage',
        '--disable-gpu',
        '--incognito',
    ],
]);
$page=$browser->newPage();
$page->setUserAgent('Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0');
$page->goto('https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html');

the answer is
Test Name Result
User Agent (Old) Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
WebDriver (New) present (failed)
Chrome (New) missing (failed)
Permissions (New) prompt
Plugins Length (Old) 0
Languages ​​(Old) en-US

the same but shows the agent ...
In general, what and where can I tweak, tell me?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question