Scrape Attribute
Line 3: | Line 3: | ||
The function returns the value of a specified element on a selected element. | The function returns the value of a specified element on a selected element. | ||
As with all other scraping, you will be scraping the data to a list or variable. | As with all other scraping, you will be scraping the data to a list or variable. | ||
+ | |||
The [[The Selectors|Element Selector]] is used to select an item for the scrape attribute. | The [[The Selectors|Element Selector]] is used to select an item for the scrape attribute. | ||
+ | |||
+ | '''Element To Scrape:''' The element on the page selected for scraping | ||
+ | |||
+ | '''Attribute To Scrape:''' The attribute of the selected page element that is going to be scraped (for example, the innerhtml) | ||
== Example == | == Example == |
Revision as of 17:28, 1 May 2013
$Scrape Attribute is a Browser Function.
The function returns the value of a specified element on a selected element. As with all other scraping, you will be scraping the data to a list or variable.
The Element Selector is used to select an item for the scrape attribute.
Element To Scrape: The element on the page selected for scraping
Attribute To Scrape: The attribute of the selected page element that is going to be scraped (for example, the innerhtml)
Example
set(#my item, $scrape attribute(<href="/files/ScriptReferences//TheSelectors.pdf">, "name"), "Global")
Running the script sets a variable named "my item". The scrape attribute scrapes the selected element by the innertext. If the innertext of the item is available on the page, the innertext is scraped to the variable, as seen in the debugger.
add list to list(%my list, $scrape attribute(<href=w"/files/ScriptReferences/*.pdf">, "innertext"), "Delete", "Global")
This script will scrape all attributes that meet the wildcard criteria by their innertext.
All scraped items are placed in a list and each one is treated as an individual list item.