I have a case where the need is to run a web application in a headless browser [either Google Chrome/Mozilla Firefox] but when web application is launched from the headless browser using a selenium + browser driver, our web application treats it as a unsupported browser and navigates to browser upgrade.
I know that this behavior is expected with the way our application is designed, but I need a workaround to make our application run in headless browsers by only changing the way I run headless browser with certain desired capability [if any available].
Was able to solve this by adding a user-agent as a driver option
--user-agent="Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 640 XL LTE) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Mobile Safari/537.36 Edge/12.10166"
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
references:
Firefox: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox
Google Chrome: https://developer.chrome.com/multidevice/user-agent
Others: https://developers.whatismybrowser.com/useragents/explore/software_name/chrome/