I’m able to load a webpage using a headed chrome driver but when trying to load the same page with headless chrome driver, the driver becomes stuck loading.
I’ve set the header agent to be the same on both, but it’s still not able to connect to the page.
Any suggestions?
I was thinking if there’s a method like
driver.capabilities[“headless”]=False
Or something like that?
Reproducible code:
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36'
chrome_path="/Users/"+pwd.getpwuid(os.getuid())[0]+"/Desktop/chromedriver"
# headless driver
chrome_options=Options()
chrome_options.add_argument("disable-infobars")
chrome_options.add_argument("headless")
chrome_options.add_argument('user-agent={'+user_agent+'}')
driver1=webdriver.Chrome(executable_path=chrome_path, chrome_options=chrome_options)
driver1.set_page_load_timeout(10)
driver1.get("http://www.adidas.com/")
Output:
TimeoutException: Message: timeout
(Session info: headless chrome=62.0.3202.94)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.13.1 x86_64)