Elemental filter (Element Filters)

Source: Internet
Author: User
Tags glob xpath

Element filters can be used with selectors and filtered from a bunch of candidate elements. They currently only make
Used for the ' name ' element selector.
The filter looks more like a selector, i.e.:
Filtertype=argument
The supported element filters are:
Value=valuepattern
Match elements based on their values. This is in the sieve of a bunch of similar named associated buttons
Check is especially useful.
Index=index
Select a single element based on its position in the list (starting at 0).
String Match style
There are a variety of style syntaxes that can be used to match string values:
Glob:pattern: Use ″glob″ to match a string. ″glob″ is a command line shells
The representative of the finite regular expression syntax. In a glob style, ″*″ represents an arbitrary sequence character set,
and
The ″?″ represents any single character. The Glob style matches the entire string.
· Regexp:regexp: Matches a string using a regular expression. You can use all JavaScript regular
An expression.
If you do not specify a style prefix, selenium assumes it is a ″glob″ style.
Seleniumactions
Addlocationstrategy (strategyname,functiondefinition)
Defines a new function for selenium to locate elements on the page. For example, if you define a
A method ″foo″, and run the Click (″foo=blah″), we will run your function and pass it to you the word
String ″blah″, and click the element returned by the function, and if it returns null, throws a ″element
Not Found″ error. We will pass three parameters to the function.
Locator: The string that the user passed over
Inwindow: The currently selected form
Indocument: The currently selected document
If the corresponding element is not found, the function must return a null.
Parameters:
strategyname– defined method name; only letters [a-za-z] can be used, cannot contain spaces
or other punctuation.
· functiondefinition– A string in the JavaScript function that defines the body.
such as: Return Indocument.getelementbyid (Locator);
AddSelection (Locator, Optiolocator)
To add a collection of selected elements in a multiple-selection element by using the Select Locator
Selection @ View #doselect details about selecting a locator.
Parameters:
locator– the element locator used to specify a multiple marquee
optionlocator– a selection locator (default is label)
Allownativexpath (Allow)
Specifies whether selenium is executed using XPath's local browse (if there is a local version available);
The recursive value is ″false″, and we will use the Pure-javascript XPath library. Use the Pure-js XPath library to
Improves the consistency of the XPath element locator in different browsers, but it executes much less quickly than the local
Perform.
Parameters:
·
Allow–boolean,true means that we prefer to use local xpath;false.
We will only use JS XPath
Altkeydown ()
Press the ALT key and keep it pressed until Doaltup () is called or a new page is loaded.
Altkeyup ()
Release the ALT key
Answeronnextprompt (Answer)
Notifies selenium to return the callback specified by the next JavaScript prompt[window.prompt ()]
Answer string.
Parameters:
answer– answer to pop-up hints
Assignid (Locator,identifier)
Temporarily sets a ″id″ property for the specified element, allowing you to use its ID in the future instead of a slow and
More complex XPath. The ID disappears after the page is overloaded.
Parameters:
locator– Element Locator pointing to an element
identifier– string used as ID for the specified element
Break ()
Pauses the currently in-progress test and waits for the user to press the Continue button. This command is very useful for debugging
Useful, but be especially careful when using it, because he will force the automated test to be suspended until the user manually
For
Check (Locator)
Tick one of the relevance buttons (Checkbox/radio)
Parameters:
locator– an element locator
Choosecancelonnextconfirmation ()
By default, the overloaded window.confirm () function of selenium returns true, equivalent to using the
After the command is executed, the next call to confirm () returns false, equivalent to
The user manually clicked Cancel. Selenium will continue to use the default behavior for subsequent confirmation actions, since
Dynamic returns True (OK) unless/until you explicitly call this command for each acknowledgment action.
Chooseokonnextconfirmation ()
Undo the effect of calling Choosecancelonnextconfirmation. Note that the overloads of the selenium
The Window.confirm () function will typically return true automatically, equivalent to the user manually clicking OK, so
You do not need to use this command unless for some reason you have to change it before the next confirmation action
Change your previous ideas. After any confirmation action, selenium will continue to use the default behavior for subsequent confirmation actions, automatically returning True (OK) unless/until you explicitly call for each acknowledgment action
Choosecancelonnextconfirmation ().
Click (Locator)
Click a link, a button, a multi-box, or a radio box. If the Click event causes a new page load (as the link usually does), the waitforpagetoload is called.

Parameters:
Locator-An element locator
Clickat (locator,coordstring)
Click a link, a button, a multi-box, or a radio box. If the Click event causes a new page load (as the link usually does), the waitforpagetoload is called.

Parameters:
Locator-An element locator
coordstring– Specifies the x, y coordinates (that is, –10,20) of the element associated with the mouse event returned by the locator
Close ()
Simulate the user clicking on the pop-up form or the ″ on the form title bar to close the ″ button.
Controlkeydown ()
Press the control key and keep it pressed until Docontrolup () is called or a new page
The face is loaded.
Controlkeyup ()
Release the Control key
Createcookie (namevaluepair,optionsstring)
Create a new cookie, unless you clearly specify the path to the cookie, otherwise its path and domain will be the same as the page currently being tested.

Parameters:
namevaluepair– the name and value of the cookie, using the following format ″name=value″
optionsstring– options for this cookie. Currently supported options include ' path ' and ' max_age '. The format for optionsstring is "path=/path/,max_age=60". The order of the options is irrelevant

Elemental filter (Element Filters)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.