Element Offset

From UBot Studio
Revision as of 19:43, 28 November 2012 by LillyT (Talk | contribs)

Jump to: navigation, search

$Element Offset is a Browser Function.

This function allows you to return just one of the elements when the element selector matches more than one element (i.e. several elements share the exact same attributes).

It will appear automatically if you are trying to select an item that is identical to another item on the page.

Example

load html("<b>One</b>
 </br>
 <b>Two</b>
 </br>
 <b>Three</b>
 </br>
 <b>Four</b>
 </br>
 <b>Three</b>
 ")
 set(#my item, $scrape attribute($element offset(<tagname="b">, 4), "innertext"), "Global")
 

The script above create an example of how the element offset function can come in handy. Notice that there are two items (the word Three) in the load html command that are identical. The script is attempting to scrape an item that is identical to another item on the page. In order to make sure that the item returned is the item that was selected with the element selector, the element offset function appears and specifies the item using a tagname and a number specific to the item.

Running the script will return only one item in the variable.

File:Offset.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox