My tests are working and running as expected with PyVirtualDisplay==0.2.1
, but I have a problem with the latest version of this package (for example, PyVirtualDisplay==0.2.5
).
My code snippet:
...
def _set_up(self):
# Creation of instance of the browser.
self.display = Display(visible=0, size=(config.WIDTH, config.HEIGHT))
self.display.start()
desired = self.get_desired_capabilities(config.BROWSER)
self.driver = webdriver.Remote(command_executor=config.ACTIVE_NODE,
desired_capabilities=desired)
# Maximize window size.
self.driver.set_window_size(config.WIDTH, config.HEIGHT)
...
Error message:
Error Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor yield File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 624, in run self.setUp() File "/Users/ratmirasanov/Documents/testing/welcome_widget/test_welcome_widget.py", line 24, in setUp self._set_up() File "/Users/ratmirasanov/Documents/testing/utilities.py", line 41, in _set_up self.display.start() File "/Users/ratmirasanov/Documents/testing/venv/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py", line 171, in start raise XStartTimeoutError(msg % d) pyvirtualdisplay.abstractdisplay.XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed).
I did not find any working solution to fix this problem. Any help will be appreciated. Thanks.
UPD: The PyVirtualDisplay==0.2.5
package is working as expected on Ubuntu 18.04.3 LTS.
Where is located the xdpyindo
program: /usr/bin/xdpyinfo
.
The problem is on my Mac (macOS Catalina 10.15.2) with XQuartz (https://www.xquartz.org/index.html) installed (xdpyindo
program is located in /opt/X11/bin/xdpyinfo
folder).