Capturing multiple values into a single selector field

I am scraping data from a survey with some multiple choice questions where more than one answer can be selected.

The results are presented in a table where the selected options are in td cells with the class .selected. All the selected results are being displayed when I preview data. However, when I scrape the pages, a new row is created resulting in multiple entries for each response. What I want is to have a single row for each response, and in the field for the multiple choice question, each selected option should be listed, delmited by a ; or some other character. Or some other way of handling multiple choice questions.

Is this possible with WebScraper?

Are you using the Grouped Selector? I think it's exactly what you're wanting but it's the only selector that I have yet to actually use myself. https://www.webscraper.io/documentation/selectors/grouped-selector

Hi dunxd
did you remember what you type in webscraper to catch the selected value data of your field
i'm trying to scrap the selected value data as you can see in my example

could you help ?

thanks for your reply
Romain

In my case, the web page added a class called selected to the field in order to highlight it, so I could use that. This might not be the case for you. You need to figure out how to identify the elements you want to scrape. Developer tools in Chrome can help as you can see the code and the selector for elements when you hover over them.

Your image didn't save properly, so I can't be much more help.

hello here my picture

21

i use Element attribute
select : select#s5f2140b9cb39f_exampleType
and don't know what to put in attribute name

an idea ?

thanks ...

You should be able to use the jQuery selector :selected to choose only the selected option from within your select list. If you want the value then use that as your attribute. If you want the text between option tags then use a Text selector instead of an element selector.

I think that is how it works.

hello

i found the solution
we must take the text type and write " option:selected" after the name of the id of the field
don't forget the space before option

1 Like

Nice one. Glad you figured it out.