Element Offset

From UBot Studio
Revision as of 17:35, 24 December 2016 by LillyT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

Element: The chosen duplicate element.

Offset: The number for the specific element being selected.

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.


.scrpregex.jpg

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox