我有PyVirtualDisplay == 0.2.5软件包的问题,该软件包用于使用虚拟显示(无头模式)运行测试
我的测试可以使用PyVirtualDisplay==0.2.1
正常运行,但该软件包的最新版本(例如PyVirtualDisplay==0.2.5
)存在问题.
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
).
我的代码段:
...
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)
...
错误消息:
错误回溯(最近一次通话最近):文件 "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", 第59行,在testPartExecutor中 产生文件"/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", 624行,运行中 self.setUp()文件"/Users/ratmirasanov/Documents/testing/welcome_widget/test_welcome_widget.py", setUp中的第24行 self._set_up()文件"/Users/ratmirasanov/Documents/testing/utilities.py",第41行,在 _设置 self.display.start()文件"/Users/ratmirasanov/Documents/testing/venv/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py", 第171行,开始时 引发XStartTimeoutError(msg%d)pyvirtualdisplay.abstractdisplay.XStartTimeoutError:无法启动X 显示:1001"(xdpyinfo检查失败).
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:PyVirtualDisplay==0.2.5
软件包在Ubuntu 18.04.3 LTS上按预期工作.
UPD: The PyVirtualDisplay==0.2.5
package is working as expected on Ubuntu 18.04.3 LTS.
xdpyindo
程序所在的位置:/usr/bin/xdpyinfo
.
问题出在我的Mac(macOS Catalina 10.15.2)上,带有XQuartz( https://www .xquartz.org/index.html )(xdpyindo
程序位于/opt/X11/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).
作为一种解决方法,可以在Mac上删除"xdpyinfo"程序.
As a workaround 'xdpyinfo' program can be removed on Mac.
以下是在GitHub上项目存储库中已创建问题的内部讨论: https://github.com/ponty/PyVirtualDisplay/issues/42
Here is a discussion inside the created issue on the project's repository on GitHub: https://github.com/ponty/PyVirtualDisplay/issues/42
UPD:实际上,这是一个权限问题.可以在执行以下操作(不删除"xdpyinfo"程序)之后将其修复:
UPD: Actually, it was a permission problem. It can be fixed after doing the following actions (without removing 'xdpyinfo' program):
mkdir /tmp/.X11-unix
sudo chmod 1777 /tmp/.X11-unix
sudo chown root /tmp/.X11-unix/
希望它对某人有帮助.