Getting started with Selenium

Source: Internet
Author: User
Tags xpath

Selenium (Getting Started) (Collection)

I. SeleniumWhat is it?
Selenium is a powerful open-source Web function testing tool series of throughtworks,

1. Selenium can use the recording tool to record the script and test the page.

2. Selenium can generate HTML-like code, Java code, and Ruby code.

3. Selenium recording tool locates HTML elements based on the ID attribute

4. Selenium ide only supports selenium language.

5. Selenium RC supports many languages, such as C #, Java, Python, and Ruby.

II.Required Software

1. Install Firefox, selenium ide plug-in, and firebug plug-in.

2. Decompress selenium's selenium-remote-control package to obtain a server.

3. Get the selenium-java-client-driver.jar for selenium development in Java language.

3. Install Firefox, selenium ide plug-in, and firebug plug-in

 

1. Selenium IDE isBased onFirefoxA browser plug-inProvides a GUI to run the selenium test.Selenium ideThe script recording function is provided to record operations performed by users in the browser, generate various forms of scripts, and save these scripts for selenium RCUse

Install selenium ideThe steps are as follows:

 

1) install Firefox

2) download selenim IDE (this is an xpi suffix file ).

3) drag the downloaded selenium ide file to the Firefox browser window and follow the prompts.

Http://release.seleniumhq.org/selenium-ide/1.0.8/

InstallFirebugThe steps are as follows:

 

1) Open the Firefox browser
2) Click "tools (t)" in the menu and select "additional components" from the drop-down list ".

3) "get additional components"

4) Enter "firebug" in the search. Wait.

5) Click "add to Firefox"

6) OK. Restart the browser.

Install selenium RCThe steps are as follows:

 

1) download the selenium-RC zip package

2) install selenium Server:

3) decompress selenium-RC zip to a specific path.

Other requirementsInstall the software as follows:

 

1) install JDK

2) install eclipse

4.Use firebugPlug-ins

 

1. Open the selenium-ide plug-in the Firefox toolbar, for example:

 

 

 

2. Select the red recording button in the upper-right corner of the plug-in Interface (this button is used to start or stop recording). For example, here, you can log on to the centralized management tool.

 

 

 

3. After the recording is complete, click the playback button to play back the recorded script. Here, you can adjust the playback speed.

 

4. You can convert the recorded script to C #, Java, PHP, Ruby, prel, groovy, Python, and other languages. Here, select Java, as shown in figure

 

 

 

5. Use of selenium-RC

 

1. Start Server:

Run the following command to start your selenium Server:

Java-jar selenium-server.jar

This command will start the selenium server, which can be started with parameters such as Java-jar selenium-server.jar-interactive for interactive mode startup

2. Open eclipse and create a test project

3. Import the selenium-java-client-driver.jar to the classpath of this project

4. convert the HTML Script recorded by selenium-ide into a Java file and import it to the new project (some modifications may be required, such as adding assert to determine whether the test case passes the test ), or use selenium-Java-client API to write test cases. This tool supports both the JUnit and testng testing frameworks.

5. Run the prepared test cases in Java ide or command line.

Vi. Other aspects

 

1. XPath: the XML query language

2. XPath Checker: Check whether the corresponding element can be found based on your written XPath. If not found, no matches found is displayed. If your XPath syntax is incorrect or the syntax error is displayed.

Note: It is generally used with firebug. Use firebug to view the HTML source code, and then estimate the source code before writing XPath.

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.