MTS icon indicating copy to clipboard operation
MTS copied to clipboard

How to enable the web driver?

Open Zimaell opened this issue 6 years ago • 1 comments

How to enable the web driver, I check for availability on this service https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html When using MTS, it shows that it is disabled ... How can I turn it on?

This my code require(ROOT.'/vendor/autoload.php'); $browserObj=\MTS\Factories::getDevices()->getLocalHost()->getBrowser('phantomjs'); $browserObj->setKeepalive(true); $browserObj->setDefaultExecutionTime(60000); $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(); $browserObj->terminate();

The ultimate goal is to make the request look like a real browser, and not be recognized as headless ...

Zimaell avatar Aug 22 '19 10:08 Zimaell

Hi,

You can append the PhantomJS options by modifying this line.

PhantomJS does support remote webdriver for e.g. selenium integration, but thats not going to help you make the browser mimic the behaiviour of your regular browser.

The maintainers of PhantomJS stopped development a few years ago, you are far better off implementing Chrome headless rather than relying on PhantomJS.

merlinthemagic avatar Sep 11 '19 10:09 merlinthemagic