Skip to content Skip to sidebar Skip to footer

Python Selenium - Website Behaves Differently When Ran Headless

I have run the following code below twice. Once with the headless argument and once without. I checked the screenshots and the website seems to behave differently when ran headless

Solution 1:

 chromeoption.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36")
 browser = webdriver.Chrome(options=chromeoption )

Try adding user-agent, when running headess user agent wil be send as headless chrome which allows website to know you are running headless. FOr this reason website may behave differently


Post a Comment for "Python Selenium - Website Behaves Differently When Ran Headless"