symfony/panther is giving "unknown error: net::ERR_NAME_NOT_RESOLVED\n (Session info: headless chrome=107.0.5304.87)" Error

233 Views Asked by At

Please help. I am getting the following error when trying to run the following code ...

Code is ...

$client = Client::createChromeClient(null, [
        '--headless',
        '--no-sandbox',
        '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36',
        '--window-size=1200,1100',
        '--disable-gpu',
     ],
     ["port" => 9080, 'request_timeout_in_ms' => 100000]
    );

$client->request('GET', 'https://www.apple.com');

The error I am getting is

unknown error: net::ERR_NAME_NOT_RESOLVED\n  (Session info: headless chrome=107.0.5304.87)",
  "#0 /var/www/html/tests/php/scraping/panther/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php(385): Facebook\\WebDriver\\Exception\\WebDriverException::throwException()\n#1 /var/www/html/tests/php/scraping/panther/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(598): Facebook\\WebDriver\\Remote\\HttpCommandExecutor->execute()\n#2 /var/www/html/tests/php/scraping/panther/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(257): Facebook\\WebDriver\\Remote\\RemoteWebDriver->execute()\n#3 /var/www/html/tests/php/scraping/panther/vendor/symfony/panther/src/Client.php(532): Facebook\\WebDriver\\Remote\\RemoteWebDriver->get()\n#4 /var/www/html/tests/php/scraping/panther/vendor/symfony/panther/src/Client.php(276): Symfony\\Component\\Panther\\Client->get()\n#5 /var/www/html/tests/php/scraping/panther/index.php(26): Symfony\\Component\\Panther\\Client->request()\n#6 {main}"
1

There are 1 best solutions below

0
On

Typically it is chromedriver and google-chrome-stable version misconfiguration.

  1. Check if you have installed chromedriver and google-chrome-stable
  2. Check if you have major version of chromedriver and chrome the same. Otherwise chromedriver can't connect and remote process with google-chrome-stable

To check version of chromedriver

chromedriver -v

and printout will be

ChromeDriver 114.0.5735.106 (5148e93c94b4990618801dd6918f26936be770f9-refs/branch-heads/5735_90@{#9})

Check version of google-chrome-stable

google-chrome-stable --version

printout will be

Google Chrome 114.0.5735.133

P.s. Workaround HIW (How it's works)

Symfony Panther(send request) -> chromedriver (API for remote managing with Chrome, that is the reason why chromedriver major version in this example 114 should be the same as chrome major version 114) -> Chrome