Select row itself?

Questions & Answers about Helium Scraper 3
Post Reply
hemeny23
Posts: 2
Joined: Wed Apr 10, 2019 2:54 am

Select row itself?

Post by hemeny23 » Wed Apr 10, 2019 3:05 am

This probably has a simple answer but I can't wrap my head around. I have watched a few of your tutorials and have created a selector that selects the rows on a site. But the tutorial then goes ahead and uses other selectors to select elements inside each row. In my case, I just want to extract from the row itself, so something like Select.Self. Does something like this exist?

I've tried selecting the row again but is not extracting anything:

Code: Select all

Select.Row
extract
   text
      Select.Row

webmaster
Site Admin
Posts: 521
Joined: Mon Dec 06, 2010 8:39 am
Contact:

Re: Select row itself?

Post by webmaster » Wed Apr 10, 2019 3:05 pm

Since the row is already selected, you don't need to select anything. If you just need the text, you can do this:

Code: Select all

Select.Row
extract
   text
      Gather.Text
The reason your current code is not extracting anything is because is trying to find a row inside a row itself and not finding it.
Juan Soldi
The Helium Scraper Team

hemeny23
Posts: 2
Joined: Wed Apr 10, 2019 2:54 am

Re: Select row itself?

Post by hemeny23 » Fri Apr 19, 2019 6:49 pm

Thanks that worked! Another probably related question. I'd like to, in addition to the row's text, extract some other text above each row into another column, but since the row is selected I'm not sure how to do this. Is there a way to select the row's parent element and then some other element inside?

webmaster
Site Admin
Posts: 521
Joined: Mon Dec 06, 2010 8:39 am
Contact:

Re: Select row itself?

Post by webmaster » Sun Apr 21, 2019 10:01 pm

You could use this premade, but it'd be easier to recreate you Select.Row selector to select the whole row (including the text above the row). To do this, first rename your Row selector as something else, then select this selector on the browser and press the Detect List button at the bottom. This should select the largest containers that contain the rows, so each selected element should include one row and the text above. With this elements selected, create a new selector and call it Select.Row.

After making these changes, your extract logic should look like this (assuming you renamed Row to InnerRow and you have a selector called TextAbove that selects the text above each row):

Code: Select all

Select.Row
extract
   text
      Select.InnerRow
   textAbove
      Select.TextAbove
Juan Soldi
The Helium Scraper Team

Post Reply