fix headless in Chrome class
This commit is contained in:
parent
cea80717c5
commit
b16dc29752
|
@ -302,7 +302,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||||
|
|
||||||
if any([_ in arg for _ in ("--headless", "headless")]):
|
if any([_ in arg for _ in ("--headless", "headless")]):
|
||||||
options.arguments.remove(arg)
|
options.arguments.remove(arg)
|
||||||
options.headless = True
|
options.add_argument('--headless')
|
||||||
|
|
||||||
if "lang" in arg:
|
if "lang" in arg:
|
||||||
m = re.search("(?:--)?lang(?:[ =])?(.*)", arg)
|
m = re.search("(?:--)?lang(?:[ =])?(.*)", arg)
|
||||||
|
@ -395,7 +395,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||||
if no_sandbox:
|
if no_sandbox:
|
||||||
options.arguments.extend(["--no-sandbox", "--test-type"])
|
options.arguments.extend(["--no-sandbox", "--test-type"])
|
||||||
|
|
||||||
if headless or options.headless:
|
if headless or '--headless' in options.arguments:
|
||||||
#workaround until a better checking is found
|
#workaround until a better checking is found
|
||||||
try:
|
try:
|
||||||
if self.patcher.version_main < 108:
|
if self.patcher.version_main < 108:
|
||||||
|
@ -485,7 +485,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||||
else:
|
else:
|
||||||
self._web_element_cls = WebElement
|
self._web_element_cls = WebElement
|
||||||
|
|
||||||
if options.headless:
|
if '--headless' in options.arguments:
|
||||||
self._configure_headless()
|
self._configure_headless()
|
||||||
|
|
||||||
def _configure_headless(self):
|
def _configure_headless(self):
|
||||||
|
|
Loading…
Reference in New Issue