Web Scrapers Generator BrowserExt

group

Is used for get-functions grouping that using the xpath.

group name {
    //group body
}
    

Parameters:

name The string giving the name of the group.

If you use a group design, then arrays, returned by get-functions will always be the same size, and the elements corresponding to the missing elements will be represented by blank strings. But in the group must always be more than one get-function.

In general, group analyzes xpath in get-functions and selects a common root. Then it selects all the elements corresponding to this root, and then with respect to each item asks xpath, which were left of each get-function after common root selecting.

Example 1. Lets take a look at the page http://scraperlab.com/test.html. It consists of divs list, in every of which there is div with title, descr and price ids. In last div element with price id is missed. Without group a price2 array will have only two elements, when others have three: