Change user-agent for Symfony Panther Chromeclient

How do I change the user-agent in a headless Chrome created by Symfony’s Panther createChromeClient()?

When I create a Chrome client with

$client = SymfonyComponentPantherClient::createChromeClient();

I see in the access_log a user-agent of

"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3865.90 Safari/537.36"

I searched for solutions, and think I have to change the user-agent string via the arguments of the chrome, but can’t find the right way, because the answers on the web aren’t for PHP or Panther.

Cheers!

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *