Introduction to Selenium

Source: Internet
Author: User
Tags continuous integration tools selenium grid

 

Selenium is an openqa application for Web applications.ProgramA good open-source tool for testing. It drives the test through javascr rjpt, and runs the test in the browser, which is closer to the user's actual operation. The positioning method is flexible. You can use tags, links, and so on directly. Of course, the most flexible and reliable method is to use XPath to locate the problem. There are almost no undefinable elements that can pass through XPath. In addition, it supports various mainstream Browser IE, Firefox, and Safari, and can be done with the same script, which is more powerful. Of course, it also has its own disadvantages: it cannot handle non-javascr platinum PT class pop-up windows, and cross-site processing is not easy. In general, selenium is a very good web testing tool.
Selenium has several testing frameworks, selenium IDE, selenium RC, selenium grid, and selenium core. In general, there are only two types of scripts: scripts written in programming languages and HTML scripts. Selenium RC and selenium IDE are commonly used. HTML scripting is easy to understand, but not flexible enough, maintenance is not so easy, and the limitations are large, suitable for non-technical personnel or unfamiliar programming. The scripts written in programming languages are flexible and powerful, and can be written in many languages, such as Java, C #, and Ruby. Therefore, it is recommended that colleagues with programming basics use selenium ide to record and save as programming language scripts for editing and maintenance.
How can I use selenium for testing? The following will briefly introduce the use of selenium IDE and discuss with colleagues in detail the use of selenium RC.

 

I. Introduction
1 Selenium is an automated testing tool specially developed by thoughtworks for Web applications. It is suitable for functional testing and acceptance testing.

2And has the following advantages:
● It can run directly on a browser, just like what real users do.
● Selenium testing can be run in Internet Explorer, Mozilla, and Firefox on Windows, Linux, macdeskshand, and other systems.
● You do not need to rely on any other tools to run the test script.

3, Testable content
◆ Browser compatibility test:
Verify whether the Web reference can be normally executed in different systems and in different browsers.
The same script can be deployed and tested in different environments without modification.
◆ System function test:
Create reusable test scripts to perform regression tests on the original content after the function and module append.

4, Selenium core (Browser BOT)
It is written in javascr Using Pt. This allows the test script to run in a supported browser. Browser bot is responsible for executing the commands received from the test script. The test script is either written in HTML table layout or a supportedProgramming Language.

5Selenium is applicable to the following browsers:

Internet Explorer Mozilla Firefox Safari
Windows XP6.01.6+,1.7+

0.8 + , 0.9 + , 1.0

Red Hat Linux
1.6 + , 1.7 + 0.8 + , 0.9 + , 1.0 +
Mac OS X 10.3 Not Supported 1.6 + , 1.7 + 0.8 + , 0.9 + , 1.0 + 1.3 +

Ii. Commands
With the selenium command, the script writer can describe the operations performed by browser BOT in the browser.
These commands can be divided into two types: Action and assertion ):
● Operation: simulates the interaction between users and Web applications.
For example, clicking a button and entering a form are common user operations. You can use the selenium command to automate these operations.
● Assertions: Verify the expected results of a command.
Common assertions include verifying that the page content or current location is correct.

The complete list of available commands can be found on the selenium website.
HTTP://Www.openqa.org/selenium-core/seleniumreference.html (the function will be translated soon)

3. Execution Mode
1 . Selenium: Test runner and driven can be used in two modes.
2 these two modes differ in complexity and writing methods:
the driven test scripts are often more complex to write, because they are written in programming languages.
however, if advanced dynamic programming languages such as Python or Ruby are used, there is little difference in complexity.
3 the biggest difference between the two modes is:
if you use the Driven Script, some tests run outside the browser, and if you use the test runner script, the test runs completely in the browser.
4 both test runner and driven test cases can be integrated with continuous integration tools.

IV. Composition
● selenium ide:
A Firefox plug - in , you can record, play back, and save test cases in HTML format.
(if the FF plug-in is not used, the recorded or edited test script must be played back under the core deployment.)
● selenium core:
the core of the entire test mechanism, test Suite runner with assertion mechanism.
it is composed of some pure JS Code and can run on Windows / different Linux browsers (equivalent to jmeter runner and assertion)
● selenium Remote Control:
A proxy and control end can replace selenium core / selenium ide client (equivalent to programming) supports multiple languages.
(equivalent to jmeter client / server mode, but selenium remote control is more powerful)

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.