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

Error on example script #2

Closed
LordTlasT opened this issue Apr 25, 2023 · 3 comments
Closed

Error on example script #2

LordTlasT opened this issue Apr 25, 2023 · 3 comments

Comments

@LordTlasT
Copy link

LordTlasT commented Apr 25, 2023

Hello, you're projects seems awesome!
Unfortunately, I cannot get it to work.
I am trying to run the example:

from handler import Handler

chatgpt = Handler("spasswd", "spasswd")
answer = chatgpt.interact("Hellow, how are you today")
print(answer)

I am using python 3.10.10 and Linux.

This is the error I get:

Traceback (most recent call last):
  File "$HOME/ChatGPT_Selenium/main.py", line 3, in <module>
    chatgpt = Handler("spasswd", "spasswd")
  File "$HOME/ChatGPT_Selenium/handler.py", line 94, in __init__
    self.browser = uc.Chrome(options=options)
  File "$HOME/ChatGPT_Selenium/env/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 409, in __init__
    browser = subprocess.Popen(
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1722, in _execute_child
    and os.path.dirname(executable)
  File "/usr/lib/python3.10/posixpath.py", line 152, in dirname
    p = os.fspath(p)
@ugorsahin
Copy link
Owner

The traceback seems uncomplete, can you share the rest of the traceback?

@LordTlasT
Copy link
Author

LordTlasT commented Apr 26, 2023

Ok, it seems I didn't have chrome installed, so I installed chromium with pacman.

Now the script keeps hanging, then after one minute this is the error I get.

Traceback (most recent call last):
  File "/home/aluc/src/ChatGPT_Selenium/main.py", line 3, in <module>
    chatgpt = Handler("supersecretlogin", "supersecretpassword")
  File "/home/aluc/src/ChatGPT_Selenium/handler.py", line 94, in __init__
    self.browser = uc.Chrome(options=options)
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 429, in __init__
    super(Chrome, self).__init__(
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    super().__init__(
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
    super().__init__(
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 715, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/home/aluc/src/ChatGPT_Selenium/env/lib/python3.10/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:55273
from unknown error: unable to discover open pages
Stacktrace:
#0 0x55be731cefe3 <unknown>
#1 0x55be72f0dd36 <unknown>
#2 0x55be72f3b48c <unknown>
#3 0x55be72f32352 <unknown>
#4 0x55be72f74af7 <unknown>
#5 0x55be72f7411f <unknown>
#6 0x55be72f6b693 <unknown>
#7 0x55be72f3e03a <unknown>
#8 0x55be72f3f17e <unknown>
#9 0x55be73190dbd <unknown>
#10 0x55be73194c6c <unknown>
#11 0x55be7319e4b0 <unknown>
#12 0x55be73195d63 <unknown>
#13 0x55be73168c35 <unknown>
#14 0x55be731b9138 <unknown>
#15 0x55be731b92c7 <unknown>
#16 0x55be731c7093 <unknown>
#17 0x7fd1e768bbb5 <unknown>

I am sorry for wasting your time,
when commenting out the --headless option, what I can see is that is succesfully logins. Skips the popups and then exits.

I am on wayland, maybe headless mode works differently.

@ugorsahin
Copy link
Owner

Hey, no worries. Thanks for the input. I am happy to hear that it is functioning now.

Also, headless was working until the point they updated stuff. I will take a look into that at some point.

Wish you a great day!

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