LjMario007 / Microsoft-Rewards-Bot

Microsoft Rewards (Bing Rewards) Bot - automated selenium python bot
19 stars 9 forks source link

Bot not working on ubuntu anymore? #76

Closed pilonull closed 2 years ago

pilonull commented 2 years ago

Hello,

recently my chrome version was updated from 96 to 98, and the bot hasn't been working.. Original error message saying that chrome 98 wasn't a supported chrome version.

I tried updating the bot, and then downgrading to chrome 96, and I still cannot get it to work.

I keep getting hung up on this after the login message:

022-02-08 21:23:01,679 :: ERROR :: root :: Found //*[@aria-label="Preferences"] element by xpath, but it is not visible or interactable. Attempting JS Click 2022-02-08 21:23:03,711 :: INFO :: root :: Logging successful. 2022-02-08 21:23:06,398 :: ERROR :: root :: Cannot find key "userStatus" NoneType: None 2022-02-08 21:23:06,414 :: INFO :: root :: Account summary: 2022-02-08 21:23:06,414 :: INFO :: root :: Available Points......... 0 2022-02-08 21:23:06,414 :: INFO :: root :: PC Search ............... 0/0 2022-02-08 21:23:06,414 :: INFO :: root :: Mobile Search ........... 0/0 2022-02-08 21:23:06,414 :: INFO :: root :: Quiz .................... 0/0 2022-02-08 21:23:06,414 :: INFO :: root :: Punch Card .............. 0/0 2022-02-08 21:23:06,414 :: INFO :: root :: ----------Already done----------- 2022-02-08 21:23:06,473 :: INFO :: root :: -------------------------------------------------- 2022-02-08 21:23:06,473 :: INFO :: root :: -----------------------End------------------------ 2022-02-08 21:23:06,473 :: INFO :: root :: -----------------------------------

Any tips or fixes?

Thanks, also feel free to let me know if I should include any further information/details.

TK7K commented 2 years ago

I'm on Ubuntu as well and I'm getting the same issue on chrome driver 98 for the last month. I'd sort of given up in hopes that the next chrome driver update would resolve jt.

charettepa commented 2 years ago

the problem is just that the user agent string is very much out of date changing it to a newer string fixes the issue

pilonull commented 2 years ago

the problem is just that the user agent string is very much out of date changing it to a newer string fixes the issue

Are you talking about the user agent strings on line 13-18 in msr.py?

Or how would I go about fixing this?

Thank you!

Wellp! Little update, I changed line 15 to the user agent version string of my installed Chrome browser (96.0.4664.45) and ran the python script again, --pc --headless and it worked!

For mobile, I updated line 18 to version string 98.0.4758.87 and that worked too!

Awesome, thanks so much for your input!

pilonull commented 2 years ago

Another little update, after fixing the user agent version strings in msr.py

I still get the errors:

2022-02-12 17:38:58,018 :: ERROR  :: root :: Element not found when searched for //*[@aria-label="Preferences"] by xpath.
2022-02-12 17:38:58,018 :: ERROR  :: root :: //*[@aria-label="Preferences"] cannot be located.
Traceback (most recent call last):
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/helper/browser.py", line 117, in click_element
    self.find_element(by_, selector).click()
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@aria-label="Preferences"]"}
  (Session info: headless chrome=96.0.4664.45)

Edit again:

Script is NOT working for quizzes still,

getting this when trying to do the quizzes:

 File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/ms_rewards.py", line 120, in <module>
    msr.work(flag_pc=parser.pc_mode, flag_mob=parser.mobile_mode,
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/msreward/msr.py", line 58, in work
    self._work(flag_pc, flag_mob, flag_quiz)
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/msreward/msr.py", line 69, in _work
    self.worker.do_dashboard(summary)
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/msreward/worker/worker.py", line 22, in do_dashboard
    self._dashboard.do_dashboard()
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/msreward/worker/dashboard/dashboard.py", line 35, in do_dashboard
    self._do_offer(link)
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/msreward/worker/dashboard/dashboard.py", line 51, in _do_offer
    self._goto_offer_link(link)
  File "/home/alex/Desktop/Microsoft-Rewards-Bot-master/msreward/worker/dashboard/dashboard.py", line 58, in _goto_offer_link
    link.click()
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/alex/.local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: headless chrome=96.0.4664.45)
pilonull commented 2 years ago

OK FINAL UPDATE! Got it worked out...

msr.py needed to be updated to ONLY contain:

# user agents for edge/pc and mobile
PC_USER_AGENT = ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36 Edg/97.0.1072.69')
MOBILE_USER_AGENT = ('Mozilla/5.0 (Linux; Android 10; HD1913) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Mobile Safari/537.36 EdgA/97.0.1072.69')

and now it's working perfectly as it's supposed to.