Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动时报错unknown error: cannot connect to chrome at 127.0.0.1:41857 #46

Closed
Pil0tXia opened this issue Dec 13, 2022 · 2 comments
Closed

Comments

@Pil0tXia
Copy link

按照这两篇文章安装了chrome,chromewebdriver,selenium和xvfb。
【避坑 超详细】Ubuntu使用python的selenium以及chrome模拟真实浏览器访问网页
在Ubuntu中使用Selenium Webdriver
但是启动docker报错如下:

rm: cannot remove '/tmp/.X11-unix/X1': No such file or directory
rm: cannot remove '/tmp/.X1': No such file or directory
Invalid screen configuration -nolisten
use: X [:<display>] [option]
-a #                   default pointer acceleration (factor)
-ac                    disable access control restrictions
-audit int             set audit trail level
-auth file             select authorization file
-br                    create root window with black background
+bs                    enable any backing store support
-bs                    disable any backing store support
-c                     turns off key-click
c #                    key-click volume (0-100)
-cc int                default color visual class
-nocursor              disable the cursor
-core                  generate core dump on fatal error
-displayfd fd          file descriptor to write display number to when ready to connect
-dpi int               screen resolution in dots per inch
-dpms                  disables VESA DPMS monitor control
-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs
-f #                   bell base (0-100)
-fc string             cursor font
-fn string             default font name
-fp string             default font path
-help                  prints message with these options
+iglx                  Allow creating indirect GLX contexts
-iglx                  Prohibit creating indirect GLX contexts (default)
-I                     ignore all remaining arguments
-ld int                limit data space to N Kb
-lf int                limit number of open files to N
-ls int                limit stack space to N Kb
-nolock                disable the locking mechanism
-maxclients n          set maximum number of clients (power of two)
-nolisten string       don't listen on protocol
-listen string         listen on protocol
-noreset               don't reset after last client exists
-background [none]     create root window with no background
-reset                 reset after last client exists
-p #                   screen-saver pattern duration (minutes)
-pn                    accept failure to listen on all ports
-nopn                  reject failure to listen on all ports
-r                     turns off auto-repeat
r                      turns on auto-repeat
-render [default|mono|gray|color] set render color alloc policy
-retro                 start with classic stipple and cursor
-s #                   screen-saver timeout (minutes)
-seat string           seat to run on
-t #                   default pointer threshold (pixels/t)
-terminate             terminate at server reset
-to #                  connection time out
-tst                   disable testing extensions
ttyxx                  server started from init on /dev/ttyxx
v                      video blanking for screen-saver
-v                     screen-saver without video blanking
-wm                    WhenMapped default backing-store
-wr                    create root window with white background
-maxbigreqsize         set maximal bigrequest size
+xinerama              Enable XINERAMA extension
-xinerama              Disable XINERAMA extension
-dumbSched             Disable smart scheduling and threaded input, enable old behavior
-schedInterval int     Set scheduler interval in msec
-sigstop               Enable SIGSTOP based startup
+extension name        Enable extension
-extension name        Disable extension
-query host-name       contact named host for XDMCP
-broadcast             broadcast for XDMCP
-multicast [addr [hops]] IPv6 multicast for XDMCP
-indirect host-name    contact named host for indirect XDMCP
-port port-num         UDP port number to send messages to
-from local-address    specify the local address to connect from
-once                  Terminate server after one session
-class display-class   specify display class to send in manage
-cookie xdm-auth-bits  specify the magic cookie for XDMCP
-displayID display-id  manufacturer display ID for request
[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]
                       enable/disable accessx key sequences
-ardelay               set XKB autorepeat delay
-arinterval            set XKB autorepeat interval
-screen scrn WxHxD     set screen's width, height, depth
-pixdepths list-of-int support given pixmap depths
+/-render                  turn on/off RENDER extension support(default on)
-linebias n            adjust thin line pixelization
-blackpixel n          pixel value for black
-whitepixel n          pixel value for white
-fbdir directory       put framebuffers in mmap'ed files in directory
-shmem                 put framebuffers in shared memory
(EE)
Fatal server error:
(EE) Invalid screen configuration -nolisten for -screen 0
(EE)
Traceback (most recent call last):
  File "/app/bot.py", line 18, in <module>
    import chatbot
  File "/app/chatbot.py", line 17, in <module>
    bot = AsyncChatbot(config.openai.dict(exclude_none=True, by_alias=False), conversation_id=None, base_url=config.openai.base_url)
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 100, in __init__
    self.refresh_session()
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 310, in refresh_session
    self.get_cf_cookies()
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 392, in get_cf_cookies
    driver = uc.Chrome(enable_cdp_events=True, options=options)
  File "/usr/local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 429, in __init__
    super(Chrome, self).__init__(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    super().__init__(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
    super().__init__(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 715, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:41857
from chrome not reachable
Stacktrace:
#0 0x556db87942a3 <unknown>
#1 0x556db8552dfd <unknown>
#2 0x556db854114b <unknown>
#3 0x556db857f843 <unknown>
#4 0x556db8576f89 <unknown>
#5 0x556db85b80b7 <unknown>
#6 0x556db85b7a5f <unknown>
#7 0x556db85af903 <unknown>
#8 0x556db8582ece <unknown>
#9 0x556db8583fde <unknown>
#10 0x556db87e463e <unknown>
#11 0x556db87e7b79 <unknown>
#12 0x556db87ca89e <unknown>
#13 0x556db87e8a83 <unknown>
#14 0x556db87bd505 <unknown>
#15 0x556db8809ca8 <unknown>
#16 0x556db8809e36 <unknown>
#17 0x556db8825333 <unknown>
#18 0x7fd4567b6ea7 start_thread
@lss233
Copy link
Owner

lss233 commented Dec 13, 2022

Duplicate of #41

@lss233 lss233 marked this as a duplicate of #41 Dec 13, 2022
@lss233 lss233 closed this as completed Dec 13, 2022
@Pil0tXia
Copy link
Author

嗯我看到#41号issue了,但是上游也没有给出解决方案。我会继续关注你的更新的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants