Skip to content

add extra args #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions botasaurus_driver/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def __init__(
self,
headless=False,
enable_xvfb_virtual_display=False,
xvfb_extra_args=None,
proxy=None,
profile=None,
tiny_profile=False,
Expand All @@ -151,12 +152,14 @@ def __init__(
host="127.0.0.1",
port=None,
):
if xvfb_extra_args is None:
xvfb_extra_args = []
if tiny_profile and profile is None:
raise ValueError("Profile must be given when using tiny profile")

if enable_xvfb_virtual_display and headless:
raise ValueError("Xvfb Virtual Display cannot be used while headless mode is enabled")

self.xvfb_extra_args = xvfb_extra_args
self.headless = headless
self.proxy = proxy
self.enable_xvfb_virtual_display = enable_xvfb_virtual_display # New attribute
Expand Down Expand Up @@ -256,7 +259,7 @@ def __call__(self):
from pyvirtualdisplay import Display

try:
self._display = Display(visible=False, size=(1920, 1080))
self._display = Display(visible=False, size=(1920, 1080), extra_args=self.xvfb_extra_args)
self._display.start()
except FileNotFoundError:
print(
Expand Down
2 changes: 2 additions & 0 deletions botasaurus_driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,7 @@ def __init__(
headless=False,
enable_xvfb_virtual_display=False,
proxy=None,
xvfb_extra_args=None,
profile=None,
tiny_profile=False,
block_images=False,
Expand All @@ -2083,6 +2084,7 @@ def __init__(
self.config = Config(
headless=headless,
enable_xvfb_virtual_display=enable_xvfb_virtual_display,
xvfb_extra_args=xvfb_extra_args,
proxy=proxy,
profile=profile,
tiny_profile=tiny_profile,
Expand Down