Is it possible to increase the resolution of a full screen screenshot using Selenium with Python? I currently take screenshots the following way and the resolution appears to be low:
browser = webdriver.Chrome('C:\Python27\chromedriver.exe')
browser.maximize_window()
browser.get("http://www.google.com")
browser.save_screenshot("savedImage.png")
To take higher-DPI screenshots in Chrome selenium webdriver try using --force-device-scale-factor
option as below:
desired_dpi = 2.0
options = ChromeOptions()
options.add_argument(f"--force-device-scale-factor={desired_dpi}")
driver = webdriver.Chrome(chrome_options=options)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With