im trying this sample to obtain the number of offers a NFT has in opensea:
import { test, expect } from '@playwright/test';
test('test', async ({ page }) => {
await page.goto('https://opensea.io/assets/ethereum/0x63217dbb73e7a02c1d30f486e899ee66d0aa5e0b/6341');
await page.waitForLoadState('networkidle');
let selector = page.locator("[id='Body offers-panel'] li");
const offers = await selector.count();
console.log('Num of offers:', offers);
});
and then I run "npx playwright tests" what always print "Num of offers: 0"
But if I run it in --headed mode, it works perfectly and outputs "Num of offers: 5"
Can anyone explain/help me to understand it?
I tried using:
let selector = page.locator("[id='Body offers-panel'] li").waitFor();
Tried to wait until all requests are done
await page.waitForLoadState('networkidle');
tried to wait for the selector:
let selector = page.locator("[id='Body offers-panel'] li").first().waitFor();
But none worked, I always have 0 count unless I run the test in --headed mode, no matter of which NFT address I try.
I would like to solve it or understand why this happen