Scraping text from a drop-down list

Describe the problem.
Hi, I'm trying to scrape the text from the size dropdown list from here

I've tried using an Element click selector to click the down arrow icon to open up the element which contains the sizes. In the Click Selector, I have the CSS selector for that

div.select_2jndxz svg.nui-icon

Then in the Selector, I have the following CSS

div.bodyWrapper_1zvJXX span

When I click on "Element preview" when the list of sizes is opened up, I see all the sizes highlighted..but when I click on "Data preview", I don't get any data. Ideally I'd like to have an array of sizes back, e.g. ["2", "4", ... "18"]. Or even separately

How can I fix this? Any help would be appreciated. Thanks,
Jug

Url: https://shop.nordstrom.com/s/eliza-j-floral-print-faille-midi-dress/4318430?origin=category-personalizedsort&breadcrumb=Home%2FWomen%2FClothing%2FDresses&color=navy%2F%20ivory

Sitemap:
{"_id":"ns-dropdown","startUrl":["https://shop.nordstrom.com/s/eliza-j-floral-print-faille-midi-dress/4318430"],"selectors":[{"id":"dropdown","type":"SelectorElementClick","selector":"div.bodyWrapper_1zvJXX span","parentSelectors":["_root"],"multiple":true,"delay":0,"clickElementSelector":"div.select_2jndxz svg.nui-icon","clickType":"clickOnce","discardInitialElements":false,"clickElementUniquenessType":"uniqueText"},{"id":"siz","type":"SelectorText","selector":"span","parentSelectors":["dropdown"],"multiple":false,"regex":"","delay":0}]}

Hi!

With an Element Click selector, you select a menu to be clicked with a Click selector, and then, once it shows items, you select the menu item (or items) to a Selector field. This is just for better understanding.

image

Please try this sitemap:
{"_id":"ns-dropdown_test","startUrl":["https://shop.nordstrom.com/s/eliza-j-floral-print-faille-midi-dress/4318430"],"selectors":[{"id":"click","type":"SelectorElementClick","selector":"li.optionsListItem_p7iE1:nth-of-type(n+1)","parentSelectors":["_root"],"multiple":true,"delay":"500","clickElementSelector":"div.select_S2HMj","clickType":"clickOnce","discardInitialElements":false,"clickElementUniquenessType":"uniqueText"},{"id":"sizes","type":"SelectorText","selector":"_parent_","parentSelectors":["click"],"multiple":false,"regex":"","delay":0}]}

1 Like

Thank you so much. I was able to extract the size info into separate rows, but I get each size in a separate row :

same_url size1
same_url size2
....
same_url size10

What I'm hoping I can do is

same_url size1,size2,size3,...,size10
or
same_url "2,4,6,8,10,12,14,16"

I modified your sitemap (see below), and the best I could get was:

same_url 246810121416

which is basically all the sizes concatenated. Is there any way to insert a separator while scraping? Otherwise, I'll find a way to work with this result string.

Sitemap:
{"_id":"ns-dropdown_test_modified","startUrl":["https://shop.nordstrom.com/s/eliza-j-floral-print-faille-midi-dress/4318430"],"selectors":[{"id":"click","type":"SelectorElementClick","selector":"ul.optionsList_Z1rfQFO","parentSelectors":["_root"],"multiple":false,"delay":"500","clickElementSelector":"div.select_S2HMj","clickType":"clickOnce","discardInitialElements":false,"clickElementUniquenessType":"uniqueText"},{"id":"sizes","type":"SelectorText","selector":"parent","parentSelectors":["click"],"multiple":false,"regex":"","delay":0}]}

Thanks again!

At first i've had the contantenated result as well, I've decided to put it in a row as you mentioned earlier.

I see now that you want all results to be in single-line. It can be done using a CSS selector called nth-child(#) to select particular size. I've made a few text selectors so you will understand the logic of it.

Please try:
{"_id":"dropdown_test","startUrl":["https://shop.nordstrom.com/s/eliza-j-floral-print-faille-midi-dress/4318430"],"selectors":[{"id":"click","type":"SelectorElementClick","selector":"div.scrollableContent_Zh0XVk > div > ul","parentSelectors":["_root"],"multiple":false,"delay":"500","clickElementSelector":"div.select_S2HMj","clickType":"clickOnce","discardInitialElements":false,"clickElementUniquenessType":"uniqueText"},{"id":"Size2","type":"SelectorText","selector":":nth-child(1)","parentSelectors":["click"],"multiple":false,"regex":"","delay":0},{"id":"Size4","type":"SelectorText","selector":":nth-child(2)","parentSelectors":["click"],"multiple":false,"regex":"","delay":0},{"id":"Size6","type":"SelectorText","selector":":nth-child(3)","parentSelectors":["click"],"multiple":false,"regex":"","delay":0},{"id":"Size8","type":"SelectorText","selector":":nth-child(4)","parentSelectors":["click"],"multiple":false,"regex":"","delay":0},{"id":"Size10","type":"SelectorText","selector":":nth-child(5)","parentSelectors":["click"],"multiple":false,"regex":"","delay":0}]}

1 Like

Thanks so much.. I modified the main selector slightly and used it!

1 Like