Last active
January 24, 2022 14:55
-
-
Save okaprinarjaya/2a3571f8684a9964df70607ee428bab7 to your computer and use it in GitHub Desktop.
Traverse DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listings = document.querySelector("#\\39 9-root-app > div > div > div.sc-fodVxV.cYLuAZ > div > div.ui-container.flex.flex-justify-between.flex-align-start.relative > div.left-container-wrapper.flex.flex-row.flex-wrap.ui-row.flex-align-start.flex-justify-start > div"); | |
// melihat semua child nodes | |
listings.childNodes; | |
// Listing number must start from index 2 | |
// because listing is start from index 2 | |
const LISTING_NUMBER = 2; | |
// melihat 1 node listing | |
listings.childNodes[LISTING_NUMBER]; | |
const listing1_images = listings.childNodes[LISTING_NUMBER].querySelectorAll("#card-carousel > div > div.ui-molecules-carousel__slider.relative > div > div"); | |
listing1_images.forEach(item => { | |
const imageElement = item.querySelector("a > span > picture > img"); | |
console.log(imageElement.attributes.src.value) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment