4

This tutorial helped me in order to gather the first drop down list entries on a website. But I am not able to get the data of the second conditional/dependent drop down box with Scrapy.

Assuming the following procedure is the way to go, how does step 2 work? The values never appear so far...

  1. Get list entries of first drop down box
  2. Select 1st value of first drop down box.
  3. get all dependent drop down values.
  4. iterate though the first drop down list...

I think the code below needs to be adjusted as the code is for a submit form:

    for i in range(len(brandCategoryList)):

        # Generate new request for each brand category's page
        yield FormRequest("http://www.xxxxxxxxxx.com",
                    method='POST',                         
                    formdata={'BrandName':'','CatBrand':brandCategoryList[i],'submit1':'Find+Product'},
                    callback=self.parseBrandPage,
                    meta={'brandCategoryId':i,'brandCategoryName':brandCategoryList[i]})

Thanks

1 Answer 1

2

Scrapy won't run any javascript code in the page you are scraping, and dependent drop-downs often rely on javascript to populate their options based on the choice in their controlling drop-down.

If you need to automate/scrape content which requires javascript, you may want to consider another library. Start here for some pointers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.