What does Relative Select do?
The relative selection command makes selections from a parent element (in the previous select command) to one, or multiple, child elements.
You should use this if you have many selections with a set of related information all on one page.
Example Uses
On an eCommerce site, such as Amazon or Etsy, you need to get associated price information, or the number of reviewers, or the product rating, or anything else on the search results page.
- You should first use a regular Select command to get each of the product's names/links.
- Use multiple relative selections, one each for the types of information you want about each product (eg. one for price, one for rating, one for company, etc.)
- Click the product link first as the parent, then click the related child information.
- If the other products don't automatically select for the same related information, do the same thing with another project to train ParseHub's selector.
- If there is information not on the search page, you need to use a Click command created from the regular Select to find that information.
In a list of movies on a site such as IMDB, you want the movie title, rating, and run time without navigating to the details page.
- Follow the instructions above like you would for an eCommerce site.
- In the relative select, make each movie the parent, and the related information the child.
- Use a new relative select for each of the related pieces of information about each movie.
You want to scrape a table containing information about game results, course listings, upcoming releases, or anything else.
- First use a regular Select command to get each of the table's row titles.
- Alternatively, if you need to scrape multiple tables, you can select the title of each table, or use the Select Zoom feature to select each table itself, then use a relative select and select each header as a child.
- Make a new relative selection from the plus button beside Begin new entry, and click the element in the first column in the table.
- ParseHub should select the first element for each row automatically, but if it doesn't, train ParseHub by doing the same thing for the second row. Name this relative selection after the column name.
- Continue to create new relative selections for each of the columns. Your result should look like this:
Anything that involves scraping multiple elements, that are related to other lists of elements on the page, should use the relative select tool.
Begin New Entry with Relative Selection
When getting data from several products, movies, or any other element on the pages, it's important that you make the relative selection nested underneath a Begin New Entry command. This command is typically hidden under a list icon ():
ParseHub typically will create this for you, but if not, it is found under the Advanced tools if you click on the plus button.