问题
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")
回答1:
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()
来源:https://stackoverflow.com/questions/33811752/opening-chromedriver-in-fullscreen-selenium-and-python