Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening ChromeDriver in fullscreen, selenium and python

I'm attempting to open my ChromeDriver in full screen. I've tried everything possible and can't seem to find a solution for it. After searching throughout google and stackoverflow it seems many people have had the same issue, this is for mac os x. I thought that doing the (command, shift, f) would work but it doesn't. Does anyone have a solution?

     from selenium import webdriver
     from selenium.webdriver.common.keys import Keys
     import time
     urls = [x,y,z]
     driver = webdriver.Chrome() #Would like chrome to start in fullscreen
     driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND, Keys.SHIFT, 'f') #not sure why this doesn't work.
     driver.get("https://example.com") 
like image 878
Milton Mendieta Avatar asked Mar 23 '26 00:03

Milton Mendieta


1 Answers

Launch chrome with argument "--kiosk" using chrome_options.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chromeOptions = Options()
chromeOptions.add_argument("--kiosk")
driver = webdriver.Chrome(chrome_options=chromeOptions) #Would like chrome to start in fullscreen
driver.get("https://example.com")
driver.quit() 
like image 86
srees Avatar answered Mar 24 '26 17:03

srees



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!