How to fetch element attribute from DIV with no Class?

Im trying to get the value of a certain element attribute but it doesnt seem to fetch it. Heres the source code:

<div data-qa-locator="product-item" data-tracking="product-card" data-sku-simple="SA623ELABGEG9NANPH-117769369" data-item-id="164411343" data-spm-anchor-id="a2o4l.searchlistbrand.list.i40.3ddc6563t8XcWC" data-aplus-ae="7ec842a8">

im trying to get the value of data-sku-simple

Url: https://www.lazada.com.ph/samsung/?style=list

Sitemap:
{"_id":"lazada","startUrl":["https://www.lazada.com.ph/samsung/?style=list"],"selectors":[{"id":"Container","type":"SelectorElement","selector":"div.cz6vLv","parentSelectors":["_root"],"multiple":true,"delay":0},{"id":"Name","type":"SelectorText","selector":"div.c3xb7P a","parentSelectors":["Container"],"multiple":false,"regex":"","delay":0},{"id":"price","type":"SelectorText","selector":"div.col3Tn span.c13VH6","parentSelectors":["Container"],"multiple":false,"regex":"","delay":0},{"id":"description","type":"SelectorText","selector":"div.c1PI6b","parentSelectors":["Container"],"multiple":false,"regex":"","delay":0},{"id":"img","type":"SelectorImage","selector":"img.c1ZEkM","parentSelectors":["Container"],"multiple":false,"delay":0},{"id":"sku","type":"SelectorElementAttribute","selector":"div.data-sku-simple","parentSelectors":["Container"],"multiple":false,"extractAttribute":"data-sku-simple","delay":0}]}

1 Like

Hi!

You seem to have chosen a wrong wrapper selector for the list. The correct one is div.c1_t2i > div

Your updated sitemap:
{"_id":"lazada","startUrl":["https://www.lazada.com.ph/samsung/?style=list"],"selectors":[{"id":"Container","type":"SelectorElement","selector":"div.c1_t2i > div","parentSelectors":["_root"],"multiple":true,"delay":0},{"id":"Name","type":"SelectorText","selector":"div.c3xb7P a","parentSelectors":["Container"],"multiple":false,"regex":"","delay":0},{"id":"price","type":"SelectorText","selector":"div.col3Tn span.c13VH6","parentSelectors":["Container"],"multiple":false,"regex":"","delay":0},{"id":"description","type":"SelectorText","selector":"div.c1PI6b","parentSelectors":["Container"],"multiple":false,"regex":"","delay":0},{"id":"img","type":"SelectorImage","selector":"img.c1ZEkM","parentSelectors":["Container"],"multiple":false,"delay":0},{"id":"sku","type":"SelectorElementAttribute","selector":"_parent_","parentSelectors":["Container"],"multiple":false,"extractAttribute":"data-sku-simple","delay":0}]}

1 Like

wow!thanks a lot. sku is now working.

another problem though is that the image url is showing in the data preview, but when I scrape it or export it to csv the image url is showing null result.

also ive come to notice that DATA preview in the image url only shows data when I have already scrolled/browse all the way down on the target page.

ive tried using Element Scroll Selector as the parent selector but still not working.

Unfortunately WebScraper scroll down selector works instantly. I believe there will be a special attribute like speed of scrolling in future releases.

Meanwhile you can either set a link selector to product pages so images will be loaded (easy solution + you can have multiple images instead of just one), or use JavaScript extension to call a scroll with a speed so content will be correctly loaded.