Closed Ulysses0817 closed 1 year ago
I dont know why the first error will happen. A Xvfb session should be started automatically in the library. Maybe that part is not working. The second error is because you cant minimize window on Xvfb. Try to delete all minimize windows function and see how it goes. Also, the google login is not very reliable. A screenshot should be available in your working directory. Check that.
I dont know why the first error will happen. A Xvfb session should be started automatically in the library. Maybe that part is not working. The second error is because you cant minimize window on Xvfb. Try to delete all minimize windows function and see how it goes. Also, the google login is not very reliable. A screenshot should be available in your working directory. Check that.
Thanks! I check the screenshot, and find that google login failed verification.
So I updated pkg to the latest and switched to session-token login, and failed again. I got the error ValueError: Invalid session token
.
[0] Platform: Linux
[0] Display: True
[0] Headless: False
[init] Starting browser
[init] Restoring session token
[init] Ensuring Cloudflare cookies
[cf] Opening new tab
[cf] Getting authorization
[cf] Validating authorization
[cf] resp is not json
[cf] Authorization is empty
Traceback (most recent call last):
File "/root/chat_test.py", line 5, in <module>
api = ChatGPT(session_token=session_token, verbose=True)
File "/root/miniconda3/lib/python3.9/site-packages/pyChatGPT/pyChatGPT.py", line 68, in __init__
self.__init_browser()
File "/root/miniconda3/lib/python3.9/site-packages/pyChatGPT/pyChatGPT.py", line 133, in __init_browser
self.__ensure_cf()
File "/root/miniconda3/lib/python3.9/site-packages/pyChatGPT/pyChatGPT.py", line 322, in __ensure_cf
raise ValueError('Invalid session token')
ValueError: Invalid session token
My session_token is copied from https://chat.openai.com/api/auth/session,
Thanks! I check the screenshot, and find that google login failed verification.
Regarding this, you can recover your account by https://accounts.google.com/signin/recovery?ec=ar_t. And you will be able to login by google (at least on my end).
My session_token is copied from https://chat.openai.com/api/auth/session
accessToken in this page means Authorization
in headers, not session_token
.
Try to copy from F12 > Application > Cookies tab.
Rogar that! Thanks to your help, I've logged in successfully and sent messages!😁
However, api.reset_conversation()
threw a new exception ElementClickInterceptedException
.😭
[send_msg] Response is not an error
nice to meet you!
Resetting conversation
Traceback (most recent call last):
File "/root/chat_test.py", line 10, in <module>
api.reset_conversation() # reset the conversation
File "/root/miniconda3/lib/python3.9/site-packages/pyChatGPT/pyChatGPT.py", line 396, in reset_conversation
self.driver.find_element(By.LINK_TEXT, 'New Thread').click()
File "/root/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
self._execute(Command.CLICK_ELEMENT)
File "/root/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 410, in _execute
return self._parent.execute(command, params)
File "/root/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "/root/miniconda3/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a class="flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm flex-shrink-0 border border-white/20">...</a> is not clickable at point (120, 31). Other element would receive the click: <div class="flex gap-2">...</div>
(Session info: chrome=108.0.5359.94)
Stacktrace:
#0 0x55d77c44f2a3 <unknown>
Maybe this error is due to the change of UI? I log into chat https://chat.openai.com and find that the chatroom UI is different from what I saw servel days ago.
However,
api.reset_conversation()
threw a new exceptionElementClickInterceptedException
.😭
Yeah. This prompt is blocking the view. I am looking into this issue.
Check v0.3.9.2
It works now. Thanks very much~
Hi, I run my script on a VPS with debian 11, chrome=108.0.5359.94, xvfb=2:1.20.11-1.
when i run the code
python chat_test.py
, i got errorselenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:39123 from chrome not reachable
Then i excute
xvfb-run -a python chat_test.py
and got this errorselenium.common.exceptions.WebDriverException: Message: unknown error: failed to change window state to 'minimized', current state is 'normal'
I think it's caused by this line, and just delete
and 'DISPLAY' not in os.environ
https://github.com/terry3041/pyChatGPT/blob/8f53882a979e7524b3b0c6e097578f7207d61333/src/pyChatGPT/pyChatGPT.py#L61then, i got the following error TimeoutException. I tried set longer time such as 35, it still didn't work: