Positioning element Brocade Set

Source: Internet
Author: User

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

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.