Hi guys I'm running some crawling script with Selenium and Python, I want to run the Chrome in headless mode so I set the headless options to true as below
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
options = Options()
options.headless = True
options.add_argument("--start-maximized")
options.add_argument("--window-size=1920,1080")
options.add_argument("--disable-gpu")
options.add_argument("--no-sandbox")
driver = webdriver.Chrome('chromedriver.exe', options=options)
But when running the script, Chrome return the web in mobile version (I've captured screenshot to check the error). Because of this my script cannot run properly
I've try many ways to change it back to desktop website, added arguments like "--window-size=1920,1080", "--start-maximized", etc.. then set browser.maximize_window()
and browser.set_window_size()
. I also try different chromedriver version but it doesn't work at all
Can anyone help me please? Many thanks.