3

Im setting a script up to flush the cache of a certain application, When running chromedriver not headless all xpath locators work fine. I set up the chrome options

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("window-size=1920,1080")

driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)

driver.get('link here')

driver.save_screenshot('file.png')

link here represents the certain link I will be going to flush the cache.

When running headless I get an unable to locate element error and the screenshots will come back as a blank page. The complete opposite when chrome is not run headless. I'm at a roadblock right now, any help or suggestions would be appreciated.

I've tried setting the windows size as well as changing the path of the chromedriver.

Yariannn
  • 31
  • 1

0 Answers0