[bug] current logic prevents custom headful mode
see config.py in botasaurus_driver:
if self.headless:
args.append("--headless=new")
else:
if is_vmish or self.enable_xvfb_virtual_display: # Modified condition
from pyvirtualdisplay import Display
try:
self._display = Display(visible=False, size=(1920, 1080))
self._display.start()
except FileNotFoundError:
print(
'To run in headfull mode with xvfb virtual display, You need to install Xvfb. Please run "sudo apt-get install xvfb" in your terminal. (Note, We are currently running in headless mode)'
)
args.append("--headless=new")
https://github.com/omkarcloud/botasaurus-driver/blob/8f5d3e4bd32266874090868e2f3e5eeb86d9e78d/botasaurus_driver/core/config.py#L252-L265
if headless is false, then only whether system is vmish determines whether we use a virtual display (pyvirtualdisplay)
in my current setup, i want to record videos of the browser, so i set up xvfb manually and pass DISPLAY in env.
this should be allowed without hacking config.py. my current solution (dockerfile):
RUN sed -i 's/^.*if is_vmish or self\.enable_xvfb_virtual_display:.*/ if (is_vmish or self.enable_xvfb_virtual_display) and not os.environ.get("DISPLAY"):/' .venv/lib/python3.*/site-packages/botasaurus_driver/core/config.py
RUN grep -q 'not os.environ.get("DISPLAY")' .venv/lib/python3.*/site-packages/botasaurus_driver/core/config.py
works with botasaurus==4.0.85
do you want to pass params to Display() object?
do you want to pass params to Display() object? i don't know how pyvirtualdisplay works. i list a fix above, i.e., skipping pyvirtualdisplay if DISPLAY is set in env. that works for my particular usecase, but isn't really ideal.
again, the problem is that right now, headless=False means "create xvfb" in docker ("vmish" in code). i manage my own xvfb and want botasaurus to use it. that doesn't seem to be supported right now without my patch above.
i've solved the problem for myself, but my suggestion is to patch botasaurus to allow a setting for "yes, i want to run headful, but despite running vmish, i do not want botasaurus to take on the responsibility of creating the xvfb for me, as i alreay did that"
I have a same issue. @tx46 Thanks for the patch!