vogler / free-games-claimer

Automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG.
GNU Affero General Public License v3.0
2.64k stars 158 forks source link

Prime - Protocol error (Page.adoptNode) #164

Closed kennymc-c closed 1 year ago

kennymc-c commented 1 year ago

All 3 Amazon Games titles from this week could not be claimed. Only Gems of Destiny from Legacy Games seems to work. I get this error message and also didn't notice anything special when connected via vnc. The process simply aborts halfway through:

2023-06-30 18:10:15.029 started checking prime-gaming
Signed in as kennymc.c
Number of already claimed games (total): 11
Number of free unclaimed games (Prime Gaming): 0
Number of free unclaimed games (external stores): 3
Current free game: Gems of Destiny: Homeless Dwarf
External store: legacy games
Code to redeem game: xxx
URL to redeem game: https://promo.legacygames.com/gems-of-destiny-prime-deal/
elementHandle.$: Protocol error (Page.adoptNode): error in channel "content::3/4/5": exception while running method "adoptNode" in namespace "page": Cannot find object with id = id-96 unsafeObject@chrome://juggler/content/content/FrameTree.js:540:11
_adoptNode@chrome://juggler/content/content/PageAgent.js:367:28
_onMessageInternal@chrome://juggler/content/SimpleChannel.js:222:37
_onMessage@chrome://juggler/content/SimpleChannel.js:191:12
bindToActor/actor.receiveMessage@chrome://juggler/content/SimpleChannel.js:54:44
_onMessageInternal@chrome://juggler/content/SimpleChannel.js:206:24
_onMessage@chrome://juggler/content/SimpleChannel.js:191:12
bindToActor/actor.receiveMessage@chrome://juggler/content/SimpleChannel.js:54:44

at file:///fgc/prime-gaming.js:125:37 {
name: 'Error'
}
kennymc-c commented 1 year ago

Ok, just ran it a third time without connected to vnc and 2 of 3 games could be claimed although I just got a notification for one game. Seems similar to #126 But I am not able to claim Baldur's Gate II even when running it multiply times. Strangely enough, unclaimed games are no longer detected. The error does not appear anymore.

OJ7 commented 1 year ago

Ok, just ran it a third time without connected to vnc and 2 of 3 games could be claimed although I just got a notification for one game. Seems similar to #126 But I am not able to claim Baldur's Gate II even when running it multiply times. Strangely enough, unclaimed games are no longer detected. The error does not appear anymore.

I'm running into this issue where three games (Star Wars, Shovel Knight, Baldurs Gate) are not being detected as unclaimed. Did some testing and noticed the claim-prime-offer-card locator is not accurate.

I have the page open and there are 43 games showing for me if I scroll all the way down. See the following results when running in a node --experimental-repl-await session.

> const games = page.locator('div[data-a-target="offer-list-FGWP_FULL"]');
undefined
> await games.locator('[data-a-target="claim-prime-offer-card"]').count()
33
> await games.locator('.item-card-details--free-game').count()
43
> await games.locator('.item-card-details--free-game').locator('p:has-text("Collected")').count()
40
> await games.locator('.item-card-details--free-game').locator('p:has-text("Claim")').count()
3

Changing the locator to .item-card-details--free-game gives you the correct count of all free games, but lose out on being able to differentiate between internal/external games.

Here's a diff between two games (internal and external). Looks like the only difference is that external games have a <div class="item-how-to-play"> added so maybe that can be used to differentiate?

Edit:

Looks like the locator for external games is also inaccurate as all games have data-a-target="learn-more-card" on them so that will need to be updated too.

vogler commented 1 year ago

@OJ7 Thanks for checking, I don't have a lot of time currently.

I noticed the internal/external confusion some time ago here as well and hoped it would sort itself out like the Claim vs. Claim game issue.

For me, all internal games still have the button text Claim game and external games have the text Claim. Is this the case for you as well? Here someone only had Claim as text for all buttons.

Looks like the only difference is that external games have a

added so maybe that can be used to differentiate?

The selectors are for unclaimed games, whereas div.item-how-to-play only exists for claimed external games.

Looks like the locator for external games is also inaccurate as all games have data-a-target="learn-more-card" on them so that will need to be updated too.

Yes, the data-a-target="learn-more-card" became irrelevant and it was just discerned via text-is (external) and has-text (internal).

vogler commented 1 year ago

https://github.com/vogler/free-games-claimer/blob/f0e15b5c7cc24343192b14e9e344b26166cc2304/prime-gaming.js#L104-L105

Old internal have data-a-target="claim-prime-offer-card" + text Claim game (or for some people also Claim). Old external have data-a-target="learn-more-card" + text Claim.

Last old internal is 'Top Hunter: Roddy & Cathy', first new internal is 'Revita'. For external games, nothing changed ('Prey' vs. 'Gems of Destiny') ?

New internal now no longer have data-a-target="claim-prime-offer-card", but seem to have the same structure as external.

Internal old vs. new (both claimed): https://www.diffchecker.com/L9sfiyVF/ External vs. new internal (both unclaimed): https://www.diffchecker.com/HSDlMo3m/

Looks like we can use data-a-target="ExternalOfferClaim" for external games vs. data-a-target="FGWPOffer" for internal games.

Seems to work for the old games as well.

vogler commented 1 year ago

Seems to work now:

$ SHOW=1 node prime-gaming.js
2023-07-13 10:54:18.782 started checking prime-gaming
Signed in as Ralf
Number of already claimed games (total): 32
Number of free unclaimed games (Prime Gaming): 6
Current free game: Star Wars: The Force Unleashed
Current free game: Shovel Knight Showdown
Current free game: Baldur's Gate II: Enhanced Edition
Current free game: Cook, Serve, Delicious! 3?!
Current free game: Roguebook
Current free game: Once Upon a Jester
Number of free unclaimed games (external stores): 1
Current free game: Gems of Destiny: Homeless Dwarf
  External store: legacy games
  Code to redeem game: x-x-x
  URL to redeem game: https://promo.legacygames.com/gems-of-destiny-prime-deal/
  Trying to redeem x-x-x on legacy games (need to be logged in)!
  Redeemed successfully? Please report problems in https://github.com/vogler/free-games-claimer/issues/5
OJ7 commented 1 year ago

For me, all internal games still have the button text Claim game and external games have the text Claim. Is this the case for you as well? Here someone only had Claim as text for all buttons.

I only have internal games available to claim which say Claim game. However, I feel like I've seen the text changing over the past few weeks (fairly confident I've also seen all of them having the same text as mentioned in that issue).

Looks like we can use data-a-target="ExternalOfferClaim" for external games vs. data-a-target="FGWPOffer" for internal games.

I think that sounds accurate. Just tested the new changes and worked for me, thanks!

kennymc-c commented 1 year ago

Had to run it twice to also claim Nairi but Forced Unleashed was claimed unlike yesterday with the old image