Clickable elements unable to crawl next page, and not using context.skipLinks() in pageFunction()


#1

Hi,

My clickable elements does not work, and I am unsure why. I am crawling this page.
My pseudo URL is https://www.tesco.com/groceries/en-GB/shop/bakery/wraps-pittas-naan-and-thins/all?page=[\d+]
My Clickable elements is a[href^="/all?page="]
My Page function is

function pageFunction(context) {
    // called on every page the crawler visits, use it to extract data from it
    var $ = context.jQuery; 
    var result = []; 
    
    var _category = $(".plp--breadcrumbs").find('span:eq(3)').text();
    var _subcategory = $(".plp--breadcrumbs").find('span:eq(5)').text();
    var _subsubcategory = $(".plp--breadcrumbs").find('span:eq(7)').text();
    
    $(".flexi-tile").each( function() { 
           
           result.push({
            
            title : $(this).find(".product-tile--title.product-tile--browsable").text(),
            price : $(this).find(".value:eq(0)").text(),
            image : $(this).find('img').attr('src'),
            
            category : $.trim(_category),
            subcategory : $.trim(_subcategory),
            subsubcategory : $.trim(_subsubcategory),
         
       });
        
    });
    
    return result;
}

Thanks!


#2

Hi @Benjamin_Doyle,

I checked your crawler and I think that clickable elements can be a problem.

Can you try to use another selector for clickable elements?
Selector .pagination-btn-holder>a can work for pagination.


#3

Solved, that worked perfectly! Thank you!