Web Automation Foundation Sharing

Source: Internet
Author: User
Tags xpath

I. Introduction of Selenium

Selenium is an acceptance testing tool ThoughtWorks specifically written for WEB applications.

The biggest benefit of using Selenium compared to other test tools is that the Selenium test runs directly in the browser, just as the real user does.

Selenium tests can be run in Windows, Internet Explorer on Linux, Mozilla, and Firefox. None of the other test tools can cover so many platforms.

Rfs=robot Framework + Selenium

Second, the environment construction

1. Install Python, we recommend using ActivePython-2.7

2. Installing wxPython2.8

3.pip Install Robotframework

4.pip Install Robotframework-ride

5.pip Install Robotframework-selenium2library

Browser driver:
Http://code.google.com/p/selenium/downloads/list

Third, Firebug installation

Iv. Basic use of RFS

1. Element positioning

Notes on ① positioning:

Sometimes, you need to go into a frame or an iframe and then position an element so that it is more efficient to use the following two keywords.

Enter a frame or IFRAME

Select Frame | Locator

Back to top frame or iframe

Unselect Frame

Expert in ② positioning: Xpath

XPath is a language that looks for information in an XML document. XPath is used to navigate through elements and attributes in an XML document.

XPath is an XML Path language used to query nodes in an XML document. Xpath is supported by mainstream browsers. The Xpath language is a tree structure based on an XML document and provides the ability to browse the tree and select nodes through a variety of criteria.

http://www.w3school.com.cn/xpath/

Locating elements with absolute paths

Xpath=/html/body/form/input

Locating elements by relative paths

Xpath=//input

Using indexes to locate elements

XPATH=//INPUT[2]

Locating elements using attribute values

xpath=//input[@id = ' username ')

xpath=//input[@id = ' username ' [@name = ' username ']

xpath=//input[@id = ' username ' and @name = ' username ')

xpath=//input[@id = ' username ' or @name = ' username ')

Using attribute names as elements

xpath=//input[@name]

Locating elements using Partial attribute values

Use values to match any attributes and elements

input[@*= ' username ']

Web Automation Foundation Sharing

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.