Selenium headless browser making WhatsApp web ask for update on chrome

Viewed 767

So I made this bot with selenium on python. While headful(non headless) it works perfectly on Firefox, Chrome and Brave. While headless, it works with Firefox, but on Chrome and Brave its asking me to update chrome. For chrome and brave its using the same webdriver. Chrome, Brave and the webdriver, all three are version 98.xxx . I have attached the image I got by capturing a screenshot with driver.save_screenshot(file) while headless.

enter image description here

1 Answers

Baasically selenium headless is picking up older version of the chrome browser. I too encountered this error in my program and I managed to fix this problem by providing the following code

chrome_options.add_argument("user-agent=User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36")
   
Related