charlesbel / Microsoft-Rewards-Farmer

A simple bot that uses selenium to farm Microsoft Rewards written in Python
MIT License
1.02k stars 272 forks source link

A,B, or C error #24

Closed njhughesSAS closed 3 years ago

njhughesSAS commented 3 years ago

Traceback (most recent call last): File "c:\Users\User\Documents\Microsoft-Rewards-Farmer-master\test\new_update.py", line 574, in <module> completeMorePromotions(browser) File "c:\Users\User\Documents\Microsoft-Rewards-Farmer-master\test\new_update.py", line 521, in completeMorePromotions completeMorePromotionABC(browser, i, 3) File "c:\Users\User\Documents\Microsoft-Rewards-Farmer-master\test\new_update.py", line 465, in completeMorePromotionABC browser.find_element_by_xpath("document.evaluate(\"//*[@id=\"QuestionPane" + str(question) + "\"]/div[1]/div[2]/a[" + str(random.randint(1, 3)) + "]/div\", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click()") File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 368, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 856, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 311, in execute self.error_handler.check_response(response) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression document.evaluate("//*[@id="QuestionPane0"]/div[1]/div[2]/a[3]/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click() because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string 'document.evaluate("//*[@id="QuestionPane0"]/div[1]/div[2]/a[3]/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click()' is not a valid XPath expression. (Session info: chrome=87.0.4280.88) source https://gist.github.com/njhughesSAS/e2a97bb18d40c49c6a6eeb5b71d8b55a

here is xpath to correct answer /html/body/div[2]/main/ol/li[1]/div/div[2]/div[1]/div[1]/div[2]/a[1]/div/div/span[2]/div/div[1]

njhughesSAS commented 3 years ago

with more promotions in a try block you get the following error on searches Traceback (most recent call last): File "c:\Users\User\Documents\Microsoft-Rewards-Farmer-master\test\new_update.py", line 580, in <module> remainingSearches, remainingSearchesM = getRemainingSearches(browser) File "c:\Users\User\Documents\Microsoft-Rewards-Farmer-master\test\new_update.py", line 530, in getRemainingSearches dashboard = getDashboardData(browser) File "c:\Users\User\Documents\Microsoft-Rewards-Farmer-master\test\new_update.py", line 358, in getDashboardData dashboard = json.loads(dashboard) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

We are also looking at the punch cards but we are never taking the quiz for them it simply refreshed the page

charlesbel commented 3 years ago

I made an update for the ABC Quiz. Does it works well now ? For the other error, on what page exactly were was you when the error poped ?

njhughesSAS commented 3 years ago

The last update to A,B,C fixed it. Unable to recreate the json loads error this evening on a different account closing the issue.

njhughesSAS commented 3 years ago

the punch card we are still skipping is https://www.bing.com/search?q=Bing%20holiday%20villains%20quiz&rnoreward=1&mkt=EN-US&skipopalnative=true&form=ML17QA&filters=IsConversation:%22true%22%20WQOskey:%22HolidayVillains_EN-US%22%20WQId:%221%22%20BTROID:%22ENUS_pcchild2_quiz_Holiday_punchcard%22%20BTROEC:%220%22%20BTROMC:%221%22

charlesbel commented 3 years ago

the punch card we are still skipping is https://www.bing.com/search?q=Bing%20holiday%20villains%20quiz&rnoreward=1&mkt=EN-US&skipopalnative=true&form=ML17QA&filters=IsConversation:%22true%22%20WQOskey:%22HolidayVillains_EN-US%22%20WQId:%221%22%20BTROID:%22ENUS_pcchild2_quiz_Holiday_punchcard%22%20BTROEC:%220%22%20BTROMC:%221%22

Fixed !