From b566ccaece868e8caf9bd76ade64283f08953b6f Mon Sep 17 00:00:00 2001 From: TheNetsky <56271887+TheNetsky@users.noreply.github.com> Date: Wed, 17 Jan 2024 18:50:43 +0100 Subject: [PATCH] 1.4.2 - Scroll back to top before searching --- package.json | 2 +- src/functions/activities/Search.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c0569bf..3e58f46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "microsoft-rewards-script", - "version": "1.4.1", + "version": "1.4.2", "description": "Automatically do tasks for Microsoft Rewards but in TS!", "main": "index.js", "engines": { diff --git a/src/functions/activities/Search.ts b/src/functions/activities/Search.ts index 6bd34de..2f1f628 100644 --- a/src/functions/activities/Search.ts +++ b/src/functions/activities/Search.ts @@ -131,6 +131,9 @@ export class Search extends Workers { // Try a max of 5 times for (let i = 0; i < 5; i++) { try { + // Go back to the top + await searchPage.keyboard.press('Home') + const searchBar = '#sb_form_q' await searchPage.waitForSelector(searchBar, { state: 'attached', timeout: 10_000 }) await searchPage.click(searchBar) // Focus on the textarea @@ -152,6 +155,7 @@ export class Search extends Workers { await this.clickRandomLink(searchPage) } + // Delay between searches await this.bot.utils.wait(Math.floor(this.bot.utils.randomNumber(this.bot.config.searchSettings.searchDelay.min, this.bot.config.searchSettings.searchDelay.max))) return await this.bot.browser.func.getSearchPoints()