pg: update selectors for internal/external games, fixes #164
This commit is contained in:
parent
04bd56cd77
commit
2e8a731573
1 changed files with 3 additions and 2 deletions
|
|
@ -97,12 +97,13 @@ try {
|
||||||
await page.click('button[data-type="Game"]');
|
await page.click('button[data-type="Game"]');
|
||||||
await page.keyboard.press('End'); // scroll to bottom to show all games
|
await page.keyboard.press('End'); // scroll to bottom to show all games
|
||||||
await page.waitForLoadState('networkidle'); // wait for all games to be loaded
|
await page.waitForLoadState('networkidle'); // wait for all games to be loaded
|
||||||
|
await page.waitForTimeout(2000); // TODO networkidle wasn't enough to load all already collected games
|
||||||
const games = page.locator('div[data-a-target="offer-list-FGWP_FULL"]');
|
const games = page.locator('div[data-a-target="offer-list-FGWP_FULL"]');
|
||||||
await games.waitFor();
|
await games.waitFor();
|
||||||
console.log('Number of already claimed games (total):', await games.locator('p:has-text("Collected")').count());
|
console.log('Number of already claimed games (total):', await games.locator('p:has-text("Collected")').count());
|
||||||
// can't use .all() since the list of elements via locator will change after click while we iterate over it
|
// can't use .all() since the list of elements via locator will change after click while we iterate over it
|
||||||
const internal = await games.locator('[data-a-target="claim-prime-offer-card"]:has-text("Claim")').elementHandles();
|
const internal = await games.locator('.item-card__action:has([data-a-target="FGWPOffer"])').elementHandles();
|
||||||
const external = games.locator('[data-a-target="learn-more-card"]:has(p:text-is("Claim"))'); // using .elementHandles() here would lead to error due to page navigation: elementHandle.$: Protocol error (Page.adoptNode)
|
const external = games.locator('.item-card__action:has([data-a-target="ExternalOfferClaim"])'); // using .elementHandles() here would lead to error due to page navigation: elementHandle.$: Protocol error (Page.adoptNode)
|
||||||
console.log('Number of free unclaimed games (Prime Gaming):', internal.length);
|
console.log('Number of free unclaimed games (Prime Gaming):', internal.length);
|
||||||
// claim games in internal store
|
// claim games in internal store
|
||||||
for (const card of internal) {
|
for (const card of internal) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue