Take a screenshot of selenium in full screen mode
I am taking a screenshot using selenium without display . It works, but it would be nice if I could take a screenshot from a full screen browser (no Firefox toolbar, etc., only on the website). I tried the above code which should print F11. The code works without error, however full screen does not work, so I think the F11 command is somehow failing. My OS is ubuntu.
Can someone tell me how to take a screenshot of selenium in full screen mode?
#!/usr/bin/env python
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
display = Display(visible=0, size=(1920, 1080))
display.start()
browser = webdriver.Firefox()
browser.get('http://www.google.com')
ActionChains(browser).send_keys(Keys.F11).perform()
browser.save_screenshot('screenshot.png')
browser.quit()
display.stop()
+3
source to share