getElement
Gets the element in the active tab, satisfying the specified conditions
Syntax
getElement = function(aTagName, aIndex, aAttributes, aValues, aStrong, aAntiAttributes, aAntiValues, aAntiStrong);
Parameters
- aTagName
- functions: tag of the desired element
- aIndex
- functions: index of the desired element
- aAttributes
- functions: array of attributes of the desired element
- aValues
- functions: array of attribute values corresponding to the array of attributes of the desired element
- aStrong
- functions: flag of match precision of the attribute values
- aAntiAttributes
- functions: array of exclusive attributes
- aAntiValues
- functions: an array of values of exclusive attributes
- aAntiStrong
- functions: flag of match precision of an exclusive attribute values
Returned value
- 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
//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 !== ''){ //emulate a click on it clickElement(element); }
//Load a page google.com loadURI('google.com'); //Get the search button var search = getElement('button',0,['class'],['gbq']);