The project needs to automate the testing of the main processes for scripting. In the process of scripting, there are some special elements that are difficult to locate. Here, make a record, easy to summarize later.
1. Locate the number of items specified in the cart
In principle, each product corresponds to a quantity control, if you want to get the number of the specified item, you must locate the block of the specified item and then locate the block's quantity control.
One thing to note is that the block must contain both the identifying and targeting elements of the product.
Amount: {get:function () {
var result = browser.element ("p=xxxxxxxxx")
. Element ("..")
. Element ("..")
. Element ("..")
. Element (". Input-numbox")
return Result.getvalue ();
}
}
2. Locate the element with the Visible property
Locate the element with the "default" identity in the receipt address record. In fact, each address record has the "default" this element, just display this property, set to None, not shown.
But the requirement is to locate the visible "default", and its location is not fixed because the "default" of other records can be activated artificially. Positioning the idea roughly, positioning this type, and then through the filter
Filter filters on attributes. Paste the following code, is the output of this visible "default" number of elements.
var defaultcount = 0;
var result = Browser.elements ('. Address-default '). Value.filter (function (item) {
if (browser.elementiddisplayed (item. ELEMENT) (value) {
Console.log (defaultcount++);
}
Positioning element Brocade Set