'Puppeteer $eval() "failed to find element matching selector" whereas a querySelector finds the matching element
I am trying to scrap vinted using puppeteer. For now, I'm just trying to get information of a given article.
Here is the html code
<div class="details-list__item-value" itemprop="brand" itemscope="" itemtype="http://schema.org/Brand">
<a class="inverse" itemprop="url" href="/brand/kiabi"><span itemprop="name">Kiabi</span></a> <menu class="overflow-menu overflow-menu--top-right">
And here is my code to get the brand :
dataObj['brand'] = await newPage.$eval('div > .inverse > span', text => text.textContent);
The thing is that when I do a querySelector() with the same selector, the console is able to retrieve it. But when I implement my piece of code I get the error :
failed to find element matching selector
So far, I tried waitForSelector(brandSelector) and I get a timeout error. I also checked if the selector was in an iframe, that is not the case.
I am running puppeteer in headless mode, when I run it in headless mode : false, I get a no frame for given id error
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
