Element Offset

From UBot Studio
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.


load html("<b>One</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.


Personal tools