Brief summary of Selenium four tool groups

Source: Internet
Author: User
Tags selenium grid

Selenium is a web-based automated testing tool.

Consists of the following groups of tools

1.selenium IDE: a Firefox plugin

Click on the plugin to enter the recording interface, to record the user's actions, and export it as a reusable test script, and support multiple languages

Advantages:

Get started quickly without programming skills

Disadvantages:

1. Distributed scripts are not reusable and difficult to maintain, and once the UI changes the test is affected.

2. The system must be available before testing. Not applicable to ATDD

3. Firefox only, no other browsers, no browser compatibility test

2.selenium RC (Selenium 1):

How it works: inject JavaScript into the browser (selenium core) to perform the test

Advantages:

Support for more browsers, almost all browsers

Disadvantages:

1. You need to start Selenium Server service.

1. In order to prevent malicious JavaScript, all browsers have enhanced the security policy of JavaScript, so some scenarios selenium 1 cannot support.

2. Programming is more oriented toward process, which may result in a large stack of repetitive methods in the project

Example:

1. Start the Server service first:

Java-jar C:\Users\qiuwy\.m2\repository\org\seleniumhq\selenium\selenium-server\2.44.0

2. Support Testing

Test code:

import org.junit.Test;

import Com.thoughtworks.selenium.DefaultSelenium;

Public class OPENBAIDUBYSELENIUM1 {

@Test

Public void openbaiduSelenium1 () {

Instantiate the Selenium1 object;

The first parameter is the host name or IP address of the selenium server, and the second parameter is the server port, which defaults to 4444;

The third parameter is to load the corresponding browser; the fourth parameter is the starting URL, and the browser points to the Selenium resource on that URL (which I don't quite understand)

Defaultselenium selenium=New defaultselenium ("localhost", 4444, "*firefox", "http://www.baidu.com");

Launch browser

Selenium.start ();

Open http://www.baidu.com in Browser

Selenium.open ("http://www.baidu.com");

Enter "Selenium" in the Baidu search box

Selenium.type ("id=kw", "Selenium");

Click on "Baidu button"

Selenium.click ("Id=su");

System. out. println (Selenium.gettitle ());

}

}

3.selenium 2 (Webdriver)

operating principle: Direct Browser Control via OST browser support or browser extension

Advantages:

1. Provide a set of friendly API, make the automation test code readability and maintainability greatly improved

2. Compared to SELENIUM1, the selenium2 is running faster.

3. The local browser can be driven to ensure that the behavior of the test is as close as possible to the user behavior

4. Ability to bypass JS limit

5. Support mobile app testing for Android (Androiddriver) and iphone (iphonedriver).

6. Can also do interface-free front-end automation testing, Htmldriver

Disadvantages:

Fewer browsers supported, Firefox (friefoxdriver), ie (Internetexploerdriver), opera (Operadriver), Chrome (Chromedriver)

Example:

@Test

Public void Openbaidubyfirefoxdriver () {

Webdriver Driver =new firefoxdriver ();

Driver.get ("http://www.baidu.com");

Driver.findelement (by. ID("kw")). SendKeys ("Htmlunit");; /enter "Htmlunit" in the Search input box

Driver.findelement (by. ID("su")). Click ();//Tap "Baidu button"

System. out. println ("page title:" +driver.gettitle ());

System. out. println ("Page URL:" +driver.getcurrenturl ());//returns the URL of the current page

Driver.close ();

}

4.Selenium Grid

It allows SELENIUM1 tests to be tested concurrently at different times in different environments, thus improving test efficiency.

Brief summary of Selenium four tool groups

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.