eg: wait for purchaseBtn to have some text, fixes #375
This commit is contained in:
parent
fef5b97e3b
commit
c8cf7362fa
1 changed files with 1 additions and 1 deletions
|
|
@ -156,7 +156,7 @@ try {
|
||||||
for (const url of urls) {
|
for (const url of urls) {
|
||||||
if (cfg.time) console.time('claim game');
|
if (cfg.time) console.time('claim game');
|
||||||
await page.goto(url); // , { waitUntil: 'domcontentloaded' });
|
await page.goto(url); // , { waitUntil: 'domcontentloaded' });
|
||||||
const purchaseBtn = page.locator('button[data-testid="purchase-cta-button"]').first();
|
const purchaseBtn = page.locator('button[data-testid="purchase-cta-button"] >> :has-text("e"), :has-text("i")').first(); // when loading, the button text is empty -> need to wait for some text {'get', 'in library', 'requires base game'} -> just wait for e or i to not be too specific; :text-matches("\w+") somehow didn't work - https://github.com/vogler/free-games-claimer/issues/375
|
||||||
await purchaseBtn.waitFor();
|
await purchaseBtn.waitFor();
|
||||||
const btnText = (await purchaseBtn.innerText()).toLowerCase(); // barrier to block until page is loaded
|
const btnText = (await purchaseBtn.innerText()).toLowerCase(); // barrier to block until page is loaded
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue