问题描述
我的测试可以使用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)
...
错误消息:
我没有找到任何可行的解决方案来解决此问题.任何帮助将不胜感激.谢谢.
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/
希望它对某人有帮助.
这篇关于我有PyVirtualDisplay == 0.2.5软件包的问题,该软件包用于使用虚拟显示(无头模式)运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!