It is easy to scrape websites with drop-down menus(How to click through options in a drop-down menu?), but how to scrape the selected options from the drop-down menus may trouble many users.
Here are two ways to scrape the option value:
- Scrape the option value directly like other data fields on the page
- Scrape the option value from the loop item
1. Scrape the option value directly like other data fields on the page
After building the loop items to switch the drop-down, just click the drop-down box and choose “Extract the text of the selected element”
We can select different options from the loop list and click extract data to check if the data field will scrape the option selected.
2. Scrape the option value from the loop item
In some cases, the option valued scraped may not change when you select different items. We would need to scrape the option value from the loop item.
- Drag an Extraction Data action into the loop item after finishing building the loop items to switch the drop-down.
- Tick the Use Loop option and click OK to save it.
- Click the drop-down menu to extract the text.
- Click the "Select" tag on the Action tips and choose the first "Option: tag
- Choose "Extract text of the selected element "
You can also select different options from the loop to see if the data fields extracted would change accordingly.