Automation (robotframework) Fundamentals · Web-side

Source: Internet
Author: User
Tags xpath

date:2018526 Day10

I. Import library

There are two types of imported libraries, one is to import common libraries, such as String, collections, etc. (Library string, collections, and then use the keywords in the library), and the other is to import the written. py file, which is also required the library. py file, Then use the keywords

two. Web Automation Fundamentals

1.selenium2library

Selenium2library is essentially the encapsulation of a series of keywords (methods) that are provided to the ride in an interface and provided to automated test calls.

Installation action:

Place the Chromedriver.exe under Python27 and run "Pip install Robotframework-selenium2library" in CMD before the library in the Suite (suite) can be completed Selenium2library

Basic use (Press F5 key shortcut search Keywords):

Click element keyword: Call this keyword to pass a parameter locator positioning

Input text keyword: This keyword needs to pass two parameters locator positioning, text input content

Select from List by value keyword: (this keyword selects an option by using the Value property in the drop-down box)

Select window Keyword: (this keyword can be selected by Url/title)

2. jquery of positioning methods

First in Chrome press F12 to open debugging, get element ID, class, etc., in the console debugging (ctrl+l= Elimination of debugging in the console), if you can successfully tune the element, you can write ride

To locate an element by ID:

To position elements through class:

There are seven conforming elements, and we need the elements in the first, so you can use EQ () to select

Note: When multiple anchor elements are found, the XPath is calculated from 1, and jquery starts with 0.

To position an element with text:

3. XPath of the positioning method ( except for text, all lookup attribute values must be @)

To locate an element by ID:

To position elements through class:

To position an element with text:

Automation (robotframework) Fundamentals · Web-side

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.