Scrape Attribute

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example)
Line 10: Line 10:
 
set(#my item, $scrape attribute(<href="/files/ScriptReferences//TheSelectors.pdf">, "name"), "Global")
 
set(#my item, $scrape attribute(<href="/files/ScriptReferences//TheSelectors.pdf">, "name"), "Global")
 
</pre>
 
</pre>
 +
  
 
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.
 
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.
 +
  
 
[[File:scrapeattribute.png]]
 
[[File:scrapeattribute.png]]
 +
  
 
<pre>
 
<pre>
 
add list to list(%my list, $scrape attribute(<href=w"/files/ScriptReferences/*.pdf">, "innertext"), "Delete", "Global")
 
add list to list(%my list, $scrape attribute(<href=w"/files/ScriptReferences/*.pdf">, "innertext"), "Delete", "Global")
 
</pre>
 
</pre>
 +
  
 
This script will scrape all attributes that meet the wildcard criteria by their innertext.
 
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.
 
All scraped items are placed in a list and each one is treated as an individual list item.
 +
  
 
[[File:scrapeattribute0.png]]
 
[[File:scrapeattribute0.png]]

Revision as of 18:39, 14 April 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.

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.


File:Scrapeattribute.png


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.


File:Scrapeattribute0.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox