charlesbel / Microsoft-Rewards-Farmer

A simple bot that uses selenium to farm Microsoft Rewards written in Python
MIT License
975 stars 261 forks source link

chrome not reachable? #363

Open nowerrrrr opened 12 months ago

nowerrrrr commented 12 months ago

Before submitting a bug report...

Title

Describe the bug

idk what it could be rlly maybe the ver of chrome compared to the driver?

Copy and paste your error

py", line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at ** from chrome not reachable Stacktrace: GetHandleVerifier [0x00CDCEB3+45171] (No symbol) [0x00C69101] (No symbol) [0x00B5BCE0] (No symbol) [0x00B50D21] (No symbol) [0x00B83A38] (No symbol) [0x00B7D73C] (No symbol) [0x00B7D56F] (No symbol) [0x00BB1AA6] (No symbol) [0x00BB163C] (No symbol) [0x00BAAE46] (No symbol) [0x00B8675E] (No symbol) [0x00B878FD] GetHandleVerifier [0x00F954B9+2897529] GetHandleVerifier [0x00FDDC6B+3194411] GetHandleVerifier [0x00FD7A41+3169281] GetHandleVerifier [0x00D66130+606960] (No symbol) [0x00C72E7C] (No symbol) [0x00C6F008] (No symbol) [0x00C6F12F] (No symbol) [0x00C61827] BaseThreadInitThunk [0x770700C9+25] RtlGetAppContainerNamedObjectPath [0x772F7B4E+286] RtlGetAppContainerNamedObjectPath [0x772F7B1E+238]

Screenshots

browser dosent open

Value of dashboard variable

none

OmegaBowser commented 11 months ago

Same here...

naughty00shortie commented 11 months ago

Chrome is not closing correctly after switching accounts. It works for the first account and then the second account gets the error. if you manually close all chrome tabs it should work again.

naughty00shortie commented 11 months ago

It looks like this is fixed by editing /src/utils.py

change self.webdriver.close() to self.webdriver.quit() on line 73

RikiCatte commented 11 months ago

It looks like this is fixed by editing /src/utils.py

change self.webdriver.close() to self.webdriver.quit() on line 73

It's not good because with quit() method you will close all selenium tabs and you don't have to do that, so you have to keep using close() method.

RikiCatte commented 11 months ago

I've changed the sleep value between () on lines 72 & 74 from 0.5 to 2 and it's working fine. before: time.sleep(0.5) after: time.sleep(2)

P.S. always in utils.py

rakosi2 commented 11 months ago

I have tried both line 73 and 72,74 edits and neither fixed my error, I have same error message but my Traceback is different. This is on a Headless Ubuntu Server 23.04

2023-10-16 14:16:05,665 [INFO] Using default request storage
2023-10-16 14:16:05,675 [INFO] Created proxy listening on 127.0.0.1:42559
2023-10-16 14:16:05,676 [INFO] Using undetected_chromedriver
2023-10-16 14:16:06,324 [INFO] patching driver executable /home/rakosi2/.local/share/undetected_chromedriver/undetected_chromedriver
2023-10-16 14:17:06,883 [ERROR] WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:35535
from chrome not reachable
Stacktrace:
#0 0x561148aa1fb3 <unknown>
#1 0x5611487752f6 <unknown>
#2 0x561148760ffa <unknown>
#3 0x5611487aca3c <unknown>
#4 0x5611487a42a9 <unknown>
#5 0x5611487e7ac6 <unknown>
#6 0x5611487de713 <unknown>
#7 0x5611487b118b <unknown>
#8 0x5611487b1f7e <unknown>
#9 0x561148a678d8 <unknown>
#10 0x561148a6b800 <unknown>
#11 0x561148a75cfc <unknown>
#12 0x561148a6c418 <unknown>
#13 0x561148a3942f <unknown>
#14 0x561148a904e8 <unknown>
#15 0x561148a906b4 <unknown>
#16 0x561148aa1143 <unknown>
#17 0x7f3c0d88f6ba <unknown>

Traceback (most recent call last):
  File "/home/rakosi2/Microsoft-Rewards-Farmer/main.py", line 24, in main
    executeBot(currentAccount, notifier, args)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/main.py", line 127, in executeBot
    with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/src/browser.py", line 41, in __init__
    self.webdriver = self.browserSetup()
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/src/browser.py", line 77, in browserSetup
    driver = webdriver.Chrome(
             ^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/seleniumwire/undetected_chromedriver/webdriver.py", line 61, in __init__
    super().__init__(*args, **kwargs)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 56, in __init__
    super().__init__(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 205, in __init__
    self.start_session(capabilities)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 724, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 289, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
    self.error_handler.check_response(response)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, 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:35535
from chrome not reachable
Stacktrace:
#0 0x561148aa1fb3 <unknown>
...
RikiCatte commented 11 months ago

I have tried both line 73 and 72,74 edits and neither fixed my error, I have same error message but my Traceback is different. This is on a Headless Ubuntu Server 23.04

2023-10-16 14:16:05,665 [INFO] Using default request storage
2023-10-16 14:16:05,675 [INFO] Created proxy listening on 127.0.0.1:42559
2023-10-16 14:16:05,676 [INFO] Using undetected_chromedriver
2023-10-16 14:16:06,324 [INFO] patching driver executable /home/rakosi2/.local/share/undetected_chromedriver/undetected_chromedriver
2023-10-16 14:17:06,883 [ERROR] WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:35535
from chrome not reachable
Stacktrace:
#0 0x561148aa1fb3 <unknown>
#1 0x5611487752f6 <unknown>
#2 0x561148760ffa <unknown>
#3 0x5611487aca3c <unknown>
#4 0x5611487a42a9 <unknown>
#5 0x5611487e7ac6 <unknown>
#6 0x5611487de713 <unknown>
#7 0x5611487b118b <unknown>
#8 0x5611487b1f7e <unknown>
#9 0x561148a678d8 <unknown>
#10 0x561148a6b800 <unknown>
#11 0x561148a75cfc <unknown>
#12 0x561148a6c418 <unknown>
#13 0x561148a3942f <unknown>
#14 0x561148a904e8 <unknown>
#15 0x561148a906b4 <unknown>
#16 0x561148aa1143 <unknown>
#17 0x7f3c0d88f6ba <unknown>

Traceback (most recent call last):
  File "/home/rakosi2/Microsoft-Rewards-Farmer/main.py", line 24, in main
    executeBot(currentAccount, notifier, args)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/main.py", line 127, in executeBot
    with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/src/browser.py", line 41, in __init__
    self.webdriver = self.browserSetup()
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/src/browser.py", line 77, in browserSetup
    driver = webdriver.Chrome(
             ^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/seleniumwire/undetected_chromedriver/webdriver.py", line 61, in __init__
    super().__init__(*args, **kwargs)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 56, in __init__
    super().__init__(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 205, in __init__
    self.start_session(capabilities)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 724, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 289, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
    self.error_handler.check_response(response)
  File "/home/rakosi2/Microsoft-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, 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:35535
from chrome not reachable
Stacktrace:
#0 0x561148aa1fb3 <unknown>
...

Try initializing both desktopBrowser = None and mobileBrowser = None, after logging.info function at line 124, when you did this, paste this code after line 159

if mobileBrowser is not None: mobileBrowser.closeBrowser()

    if desktopBrowser is not None:
        desktopBrowser.closeBrowser()

This way it should force the correct closing of both browsers (only if they are valorized). I'm running that on windows 11, but I don't think the problem is the different platform.

rakosi2 commented 11 months ago

@RikiCatte I tried that on main.py and I still get same error message.