Currently I have the following partial code in my puppeteer file:
const getImgSrc = await page.$eval('#ldpGallery', el => el.getElementsByTagName('img'));
console.log(getImgSrc);
The html I'm getting this from is this:
<img data-src="https://example.com/981489624/e132d90154bc6cbc6616442c0742fc43l-m0xd-w1020_h770_q80.jpg" class="owl-lazy" src="">
The results I get in my console is this:
{ '0': {},
'1': {},
'2': {},
'3': {},
'4': {} }
I'm trying to access data-src from the above html. After I retrieve the object I tried. forEach() and map and they both give me an error.
How would I get the data-src string?
The best approach is trying to solve everything all the data fetching on the evaluate. You could do something like this:
const getImgSrc = await page.$eval('#ldpGallery', el =>
Array.from(el.getElementsByTagName('img')).map(e => e.getAttribute("data-src")));
console.log(getImgSrc);
I have created a modal list using bootstrap and Actually I have a form list created and when entered details, it will land me to a desired page. Register button performs this function. But now I have ...
I have created a modal list using bootstrap and Actually I have a form list created and when entered details, it will land me to a desired page. Register button performs this function. But now I have ...
I am attempting to store html code in a textarea field using jquery with the following code: var text ="<p>Hello, my name is Sam</p>"; var textarea = d.createElement( 'textarea' ); // ...
I am attempting to store html code in a textarea field using jquery with the following code: var text ="<p>Hello, my name is Sam</p>"; var textarea = d.createElement( 'textarea' ); // ...
I have this multi dimensional array of objects - const initialArray = [ { name: 'aaa', value:[{id:1, data:1}, {id:2, data:2}, {id:3, data:3}] }, { name: 'bbb', value:[{id:1, data:...
I have this multi dimensional array of objects - const initialArray = [ { name: 'aaa', value:[{id:1, data:1}, {id:2, data:2}, {id:3, data:3}] }, { name: 'bbb', value:[{id:1, data:...
Let's say I have a number input with only a few possible values like the following : <label for="test" translate="entities.test"></label> <input id="test" name="test" type="number" min=...
Let's say I have a number input with only a few possible values like the following : <label for="test" translate="entities.test"></label> <input id="test" name="test" type="number" min=...