klept0 / MS-Rewards-Farmer

A simple bot that uses Selenium to farm M$ Rewards in Python
MIT License
217 stars 46 forks source link

Bug: Login with code instead of password #198

Open ttraxxrepo opened 1 week ago

ttraxxrepo commented 1 week ago

Before submitting a bug report...

Branch

master

Commit

0a94091

Describe the bug

Sometimes when logging in to Microsoft, it defaults to emailing a 2fa code instead of pulling up the input to provide a password.

Proposed after entering username in the login input, the following code to click "Use Your Password Instead" switch to the password input should the code option be what defaults:

        # If it sends email code, switch to password
        if sb.is_element_visible("#idA_PWD_SwitchToPassword"):
            sb.uc_click("#idA_PWD_SwitchToPassword")

Copy and paste your error

2024-09-02 16:53:22 [ERROR] [root] [main.py:42] 
Traceback (most recent call last):
  File "/msrewards/main.py", line 40, in main
    earned_points = executeBot(currentAccount, args)
  File "/msrewards/main.py", line 235, in executeBot
    with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
  File "/msrewards/src/browser.py", line 52, in __init__
    self.webdriver = self.browserSetup()
  File "/msrewards/src/browser.py", line 109, in browserSetup
    driver = webdriver.Chrome(
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/undetected_chromedriver/webdriver.py", line 61, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/undetected_chromedriver/__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__
    self.start_session(capabilities)
  File "/usr/local/lib/python3.10/dist-packages/undetected_chromedriver/__init__.py", line 724, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to chrome at 127.0.0.1:42801
from chrome not reachable
Stacktrace:
#0 0x5581889fc86a <unknown>
#1 0x5581886cac91 <unknown>
#2 0x5581886b693f <unknown>
#3 0x558188708813 <unknown>
#4 0x5581886fe4bc <unknown>
#5 0x55818874b64e <unknown>
#6 0x55818874ae66 <unknown>
#7 0x55818873f233 <unknown>
#8 0x55818870d093 <unknown>
#9 0x55818870e09e <unknown>
#10 0x5581889c3acb <unknown>
#11 0x5581889c7a81 <unknown>
#12 0x5581889af695 <unknown>
#13 0x5581889c85f2 <unknown>
#14 0x55818899486f <unknown>
#15 0x5581889eb668 <unknown>
#16 0x5581889eb832 <unknown>
#17 0x5581889fb65c <unknown>
#18 0x7fe29313cac3 <unknown>
all values are hidden
2024-09-02 16:53:22 [WARNING] [root] [utils.py:55] config-private.yaml doesn't exist
2024-09-02 16:53:22 [INFO] [root] [main.py:65] [POINTS] Data saved for the next day.

Screenshots

Screenshot 2024-09-02 at 4 49 39 PM

Value of dashboard variable

N/A

cal4 commented 1 week ago

Try reproducing, #201 has changed this code a bit