How to:

Multiple variations

Description:

To prevent Web Scraper from clicking on the default option, combine ":not()" jQuery selector with ":contains()" jQuery selector containing the default text.
To prevent Web Scraper from clicking on unavailable options, find an attribute or class that is unique to them and include them in ":not()" jQuery selector.
Web Scraper adds "selected" attribute to option element that it clicked on so the selected value can be scraped by setting "option[selected]" CSS selector.
To iterate through more than two item variation selects, repeat the same steps as for "product-wrapper-two" and create data extraction selectors only for the last click selector.

Sitemap:

{"_id":"web-scraper-product-with-multiple-variations","startUrl":["https://webscraper.io/test-sites/e-commerce/allinone/product/495"],"selectors":[{"id":"product-wrapper-one","type":"SelectorElementClick","parentSelectors":["_root"],"selector":"body","multiple":true,"delay":"500","clickElementSelector":"div.dropdown select option:not(:contains('Select color'))","clickType":"clickOnce","discardInitialElements":"discard-when-click-element-exists","clickElementUniquenessType":"uniqueCSSSelector"},{"id":"product-wrapper-two","type":"SelectorElementClick","parentSelectors":["product-wrapper-one"],"selector":"_parent_","multiple":true,"delay":"500","clickElementSelector":"button.swatch:not(.disabled)","clickType":"clickOnce","discardInitialElements":"discard-when-click-element-exists","clickElementUniquenessType":"uniqueCSSSelector"},{"id":"price","type":"SelectorText","parentSelectors":["product-wrapper-two"],"selector":"h4.price","multiple":false,"regex":"","delay":0},{"id":"color","type":"SelectorText","parentSelectors":["product-wrapper-two"],"selector":"div.dropdown select option[selected]","multiple":false,"regex":"","delay":0},{"id":"memory","type":"SelectorText","parentSelectors":["product-wrapper-two"],"selector":"button.active","multiple":false,"regex":"","delay":0}]}

Was this page helpful?