GetElement

Gets the element in the active tab, satisfying the specified conditions

Syntax

function GetElement(aTagName: string='*'; aIndex: integer=-1;
  aAttributes, aValues: array of string=[];
  aStrong: boolean=false; aAntiAttributes, aAntiValues: array of string=[];
  aAntiStrong: boolean=false): TCSElement;

Parameters

  • aTagName
    • type: string
    • functions: tag of the desired element
  • aIndex
    • type: integer
    • functions: index of the desired element
  • aAttributes
    • type: array of string
    • functions: array of attributes of the desired element
  • aValues
    • type: array of string
    • functions: array of attribute values ​​corresponding to the array of attributes of the desired element
  • aStrong
    • type: boolean
    • functions: flag of match precision of the attribute values
  • aAntiAttributes
    • type: array of string
    • functions: array of exclusive attributes
  • aAntiValues
    • type: array of string
    • functions: an array of values of exclusive attributes
  • aAntiStrong
    • type: boolean
    • functions: flag of match precision of an exclusive attribute values

Returned value

  • type: TCSElement
  • functions: structure that contains the parameters of the found element

Notes

  • When searching for an element the script enumerates all elements that have values ​​aValues of aAttributes​​ attributes. Of these elements, the script selects the elements that are not have values aAntiValues of ​​aAntiAttributes attributes. If aStrong flag is true, the element is found, the values ​​of properties aValues of ​​aAttributes of which are strictly equal to the specified (sensitive search is not considered). Otherwise, the element is found, in property values ​​aAttributes of which includes the corresponding values ​​aValues. Similarly, with the flag aAntiStrong.
  • If the index of the desired element aIndex is -1, it will be obtained a random element from found ones.
  • If no elements are found, then the resulting structures of the field will be empty.
  • Found element is highlighted by a dotted frame

Examples

  1. //Obtain a random element from all, having tag "a" (obtain random link)
    var element:=GetElement('a');
    //If the element is found, the
    if element.varName<>'' then
    //emulate a click on it
    ClickElement(element);
  2. //Load a page google.com
    LoadURI('google.com');
    //Get the search button
    var search:=GetElement('button',0,['class'],['gbq']);