Add better checking for version_main to add headless flag

Gets rid of the logger warning message when version_main is None
This commit is contained in:
jdholtz 2023-08-23 23:30:40 -05:00
parent a415e40b0b
commit 0e26e6122e
No known key found for this signature in database
GPG Key ID: A3A87CFD1E4A1B65
1 changed files with 3 additions and 9 deletions

View File

@ -396,16 +396,10 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
options.arguments.extend(["--no-sandbox", "--test-type"])
if headless or options.headless:
#workaround until a better checking is found
try:
if self.patcher.version_main < 108:
if not self.patcher.version_main or self.patcher.version_main >= 108:
options.add_argument("--headless=new")
else:
options.add_argument("--headless=chrome")
elif self.patcher.version_main >= 108:
options.add_argument("--headless=new")
except:
logger.warning("could not detect version_main."
"therefore, we are assuming it is chrome 108 or higher")
options.add_argument("--headless=new")
options.add_argument("--window-size=1920,1080")
options.add_argument("--start-maximized")