LET amazon = DOCUMENT('https://www.amazon.com/', true) INPUT(amazon, '#twotabsearchtextbox', @criteria) CLICK(amazon, '.nav-search-submit input[type="submit"]') WAIT_NAVIGATION(amazon) LET resultListSelector = '#s-results-list-atf' LET resultItemSelector = '.s-result-item' LET nextBtnSelector = '#pagnNextLink' LET vendorSelector = 'div > div > div > div.a-fixed-left-grid-col.a-col-right > div.a-row.a-spacing-small > div:nth-child(2) > span:nth-child(2)' LET priceSelector = 'div > div > div > div.a-fixed-left-grid-col.a-col-right > div:nth-child(4) > div.a-column.a-span7 > div:nth-child(1) > div:nth-child(3) > a > span.a-offscreen' LET altPriceSelector = 'div > div > div > div.a-fixed-left-grid-col.a-col-right > div:nth-child(2) > div.a-column.a-span7 > div:nth-child(1) > div:nth-child(3) > a > span.a-offscreen' LET result = ( FOR pageNum IN PAGINATION(amazon, nextBtnSelector) LIMIT @limit LET wait = pageNum > 0 ? WAIT_NAVIGATION(amazon) : false LET waitSelector = wait ? WAIT_ELEMENT(amazon, resultListSelector) : false LET items = ( FOR el IN ELEMENTS(amazon, resultItemSelector) LET priceTxtMain = INNER_TEXT(el, priceSelector) LET priceTxt = priceTxtMain != "" ? priceTxtMain : INNER_TEXT(el, altPriceSelector) RETURN { title: INNER_TEXT(el, 'h2'), vendor: INNER_TEXT(el, vendorSelector), price: TO_FLOAT(SUBSTITUTE(priceTxt, "$", "")) } ) RETURN items ) RETURN FLATTEN(result)