Have option to run Chrome in full screen mode by default

This commit is contained in:
Michael Mintz 2017-10-02 12:50:50 -04:00
parent 31e90ff910
commit e54cfb3000
2 changed files with 9 additions and 0 deletions

View File

@ -72,6 +72,9 @@ to be True since it's part of wait_for_ready_state_complete().
# Called after each wait_for_ready_state_complete()
WAIT_FOR_ANGULARJS = False
# Option to start Chrome in full screen mode by default
START_CHROME_IN_FULL_SCREEN_MODE = False
# #####>>>>>----- MasterQA SETTINGS -----<<<<<#####
# ##### (Used when importing MasterQA as the parent class)

View File

@ -1,6 +1,7 @@
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from seleniumbase.config import settings
from seleniumbase.core import download_helper
from seleniumbase.fixtures import constants
@ -77,6 +78,11 @@ def get_driver(browser_name):
chrome_options.add_experimental_option("prefs", prefs)
chrome_options.add_argument("--allow-file-access-from-files")
chrome_options.add_argument("--allow-running-insecure-content")
if settings.START_CHROME_IN_FULL_SCREEN_MODE:
# Run Chrome in full screen mode on WINDOWS
chrome_options.add_argument("--start-maximized")
# Run Chrome in full screen mode on MAC/Linux
chrome_options.add_argument("--kiosk")
return webdriver.Chrome(chrome_options=chrome_options)
except Exception:
return webdriver.Chrome()