Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

BUG: specify --no-sandbox before --headless #59

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions altair_saver/savers/_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,17 @@ def get(self, webdriver: Union[str, WebDriver], driver_timeout: float) -> WebDri
)

webdriver_options = webdriver_options_class()
webdriver_options.add_argument("--headless")

if issubclass(webdriver_class, selenium.webdriver.Chrome):
# for linux/osx root user, need to add --no-sandbox option.
# since geteuid doesn't exist on windows, we don't check it
if hasattr(os, "geteuid") and (os.geteuid() == 0):
webdriver_options.add_argument("--no-sandbox")
# For linux/osx root user with Chrome, need to add --no-sandbox option, which
# must come before the --headless option. Note: geteuid doesn't exist on windows.
if (
issubclass(webdriver_class, selenium.webdriver.Chrome)
and hasattr(os, "geteuid")
and os.geteuid() == 0
):
webdriver_options.add_argument("--no-sandbox")

webdriver_options.add_argument("--headless")

driver_obj = webdriver_class(options=webdriver_options)
atexit.register(driver_obj.quit)
Expand Down