Skip to content

Commit

Permalink
1.4.2
Browse files Browse the repository at this point in the history
- Scroll back to top before searching
  • Loading branch information
TheNetsky committed Jan 17, 2024
1 parent 15b2b82 commit b566cca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions src/functions/activities/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit b566cca

Please sign in to comment.