How to click a “select option” and then evaluate loaded content with casperjs

后端 未结 9 1418
长情又很酷
长情又很酷 2021-01-02 01:46

I\'m trying to crawl the sizes for this product:

Link to product

The problem: The sizes are loaded after the color of the product is selected.

In th

9条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-02 02:17

    Got same issue here. My solution is:

    casper.then(function(){
        this.evaluate(function() {
            document.querySelector('select.select-category').selectedIndex = 2; //it is obvious
        });
        this.capture('screenshot.png');
    });
    

提交回复
热议问题