嗨,我是 selenium 自动化的新手。
我编写的代码工作正常并在 pycharm 和命令提示符下执行,但是当我尝试从远程服务器执行相同的代码时,我收到以下错误。
我将其理解为使用 pynput 做某事,但我无法弄清楚如何解决它。如果有人知道,请帮助我。
File "/home/manoj/forum-test-suite/test_forum_page/PageObject/common_methods.py", line 6, in <module>
from pynput.keyboard import Key,Controller
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/__init__.py", line 23, in <module>
from . import keyboard
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/keyboard/__init__.py", line 49, in <module>
from ._xorg import KeyCode, Key, Controller, Listener
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/keyboard/_xorg.py", line 39, in <module>
from pynput._util.xorg import (
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/_util/xorg.py", line 40, in <module>
_check()
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/_util/xorg.py", line 38, in _check
display = Xlib.display.Display()
File "/home/manoj/newenv/lib/python3.6/site-packages/Xlib/display.py", line 89, in __init__
self.display = _BaseDisplay(display)
File "/home/manoj/newenv/lib/python3.6/site-packages/Xlib/display.py", line 71, in __init__
protocol_display.Display.__init__(self, *args, **keys)
File "/home/manoj/newenv/lib/python3.6/site-packages/Xlib/protocol/display.py", line 167, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)