TychoTheTaco / Twitch-Drops-Bot

A Node.js bot that will automatically watch Twitch streams and claim drop rewards.
MIT License
279 stars 36 forks source link

ERROR: Error: No node found for selector: [data-a-target="player-settings-menu-item-quality"] #2

Closed agret closed 3 years ago

agret commented 3 years ago

Watching stream: https://www.twitch.tv/frtin Setting stream quality to lowest available... ERROR: Error: No node found for selector: [data-a-target="player-settings-menu-item-quality"] at Object.assert (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\assert.js:26:15) at DOMWorld.click (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:277:21) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:95:5) at async setLowestStreamQuality (M:\Development\Twitch-Drops-Bot\index.js:263:5) at async watchStreamUntilDropCompleted (M:\Development\Twitch-Drops-Bot\index.js:202:5) at async processCampaign (M:\Development\Twitch-Drops-Bot\index.js:364:17) at async M:\Development\Twitch-Drops-Bot\index.js:616:17 Stream failed too many times. Giving up...

agret commented 3 years ago

I commented out line 202 which called setLowestStreamQuality to get past this issue.

TychoTheTaco commented 3 years ago

It seems like you might be using the default browser that comes with puppeteer which doesn't work. Try using a standalone installation of Chrome.

Kraker01 commented 3 years ago

I'm experiencing the same problem. My config file is the following: { "browser":"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "games":[] }

The error I receive is the following one: Setting stream quality to lowest available... ERROR: Error: No node found for selector: [data-a-target="player-settings-menu-item-quality"] at Object.assert (C:\Twitch-Drops-Bot-master\node_modules\puppeteer\lib\cjs\puppeteer\common\assert.js:26:15) at DOMWorld.click (C:\Twitch-Drops-Bot-master\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:277:21) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async setLowestStreamQuality (C:\Twitch-Drops-Bot-master\index.js:274:5) at async watchStreamUntilDropCompleted (C:\Twitch-Drops-Bot-master\index.js:213:5) at async processCampaign (C:\Twitch-Drops-Bot-master\index.js:375:17) at async C:\Twitch-Drops-Bot-master\index.js:650:17 Stream failed too many times. Giving up...

TychoTheTaco commented 3 years ago

I just pushed a potential fix.

Kraker01 commented 3 years ago

Seems like it isn't working.

Found 9 active streams Watching stream: https://www.twitch.tv/ftlak Watching stream |█████████████████████████░░░░░░░░░░░░░░░| 63% | 57 / 90 minutes | Remaining: 33 minutesFailed to set stream to lowest quality! TimeoutError: waiting for selector [data-a-target="player-settings-menu-item-quality"] failed: timeout 30000ms exceeded at new WaitTask (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:509:34) at DOMWorld.waitForSelectorInPage (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:420:26) at Object.internalHandler.waitFor (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\QueryHandler.js:31:77) at DOMWorld.waitForSelector (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:313:29) at Frame.waitForSelector (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:841:51) at Page.waitForSelector (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1335:33) at setLowestStreamQuality (C:\Users\Marco\Documents\GitHub\Twitch-Drops-Bot\index.js:278:16) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

TychoTheTaco commented 3 years ago

Can you try using branch bug-2? It will create some files: page_content_0.html, settings_menu_0.html, etc. that will help me debug. You can attach the files here.

Also, you can try with the --headful option and see if anything unexpected happens (see if the settings menu actually opens).

Kraker01 commented 3 years ago

Switched to branch bug-2. Script isn't working anyway. This is what i get opening "page_content_0.html" with Notepad++

<!DOCTYPE html>(3) glermz - Twitch

Hardcore !rules | New !drop & patch 💦 | !discord #SocialClub

472

1:45:32

About glermz

53K followers

Salty codfish, energetic, good vibes, and spicy content! Mature Language. Business contact: glermzsocial@gmail.com

C1

The broadcaster has indicated that this channel is intended for mature audiences.

Stream Chat

TychoTheTaco commented 3 years ago

Can you attach all the page_content_*.html and settings_menu_*.html here (drag and drop them instead of copy paste).

TychoTheTaco commented 3 years ago

I think I've figured out what's happening based on the contents you posted. The script fails to click the "accept mature content" button and so the settings button never becomes available. I've changed it now so that it waits longer for the page to load completely which should hopefully fix the issue.

Kraker01 commented 3 years ago

Downloaded and set up from scratch. I think there's a new error popping up, I'll attach all the needed files.

screenshot page_content_0.zip

agret commented 3 years ago

Sadly still broken, i'm using the latest commit from 8hrs ago on the main branch and just got this again

image

Drop: A-Coin 500 Found 1 active streams Watching stream: https://www.twitch.tv/nimbleneuron Watching stream |░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░| 0 / 60 minutesFailed to set stream to lowest quality! TimeoutError: waiting for selector[data-a-target="player-settings-menu-item-quality"]failed: timeout 30000ms exceeded at new WaitTask (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:509:34) at DOMWorld.waitForSelectorInPage (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOM World.js:420:26) No progress was made since last update!M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\Que Found 1 active streams Watching stream: https://www.twitch.tv/nimbleneurontch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld. Watching stream |░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░| 0 / 60 minutesFailed to set stream to lowest quality! TimeoutError: waiting for selector[data-a-target="player-settings-menu-item-quality"]failed: timeout 30000ms exceededr at new WaitTask (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:509:34) at DOMWorld.waitForSelectorInPage (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOM World.js:420:26) at Object.internalHandler.waitFor (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\Que ryHandler.js:31:77)s (<anonymous>) at DOMWorld.waitForSelector (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld. js:313:29) at Frame.waitForSelector (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager .js:841:51) at Page.waitForSelector (M:\Development\Twitch-Drops-Bot\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1335: 33) at setLowestStreamQuality (M:\Development\Twitch-Drops-Bot\index.js:295:16) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:95:5)

agret commented 3 years ago

Now back onto the bug2 branch and here's my error

Processing campaign: Eternal Return EMOTE DROPS! - 소니쇼 팀 Drop: Emote - 소니쇼 Found 1 active streams Watching stream: https://www.twitch.tv/sonycast_ SFailed to set stream to lowest quality! TypeError: Cannot read property 'getProperty' of undefined at setLowestStreamQuality (M:\Development\Twitch-Drops-Bot-Bug\index.js:304:132) at processTicksAndRejections (internal/process/task_queues.js:95:5) saved screenshot

page_content.zip

Kyraminol commented 3 years ago

I should have fixed this issue with pull request https://github.com/TychoTheTaco/Twitch-Drops-Bot/pull/3

TychoTheTaco commented 3 years ago

This issue should be fixed now. The popup was blocking puppeteer from clicking. I've changed it so that the clicks are now done directly via JavaScript instead of through puppeteer, which means elements that are under other elements can still be clicked.

One thing I noticed while testing is that this error still happens if the stream fails to load, but this seemed to only happen on the first attempt after starting the script.

Kraker01 commented 3 years ago

tested latest master branch

working like a charm

agret commented 3 years ago

Have left the app running overnight on latest master branch and also confirm it is fixed for good this time. Working well with the fix for #4 also. Thanks.