Selenium-RC study note _ 01 _ installation and Setup

Source: Internet
Author: User

The following describes how to build a script compiling environment Using Selenium test in eclipse-JUnit,


Make sure that you have installed JDK and eclipse.


1. First download the required file

Download the jar package required by selenium-RC from the Internet, which can be downloaded from the official website http://seleniumhq.org/download/or from the Internet.

I downloaded a selenium-remote-control-1.0.3.zip.

:
Http://download.csdn.net/detail/spring292713/4456349

Download the jar package of junit4.8 because an error is reported when I use the JUnit package that comes with eclipse. java. Lang. noclassdeffounderror: JUnit/framework/testcase;

It will be okay after you replace JUnit downloaded from the official website.

2. Create a test project and import relevant jar files.

Open eclipse and create a Java project. Right-click the project name and choose build path> Add libraries> User library, click User library> newin the dialog box to add the selenium-java-client-driver.jar under selenium-Java-client-driver-1.0.1 in selenium-remote-control-1.0.3.zip to the library;

Similarly, add the junit-4.7.jar under the next JUnit to the library,

Then, import the two jar files to classpath;

4. Set selenium resource file connection

Select a project, right-click build path-> link source, select the selenium-Java-client-driver-1.0.3 folder under selenium-remote-control-1.0.1, and finish.

5. Create a new test class and enter the test code as follows:


package com.example.Open;import com.thoughtworks.selenium.*;public class Test  extends SeleneseTestCase{public void setUp() throws Exception {setUp("http://www.baidu.com");} public void testUntitled()throws Exception {selenium.open("/");}}

6. Start selenium-Server

Go to selenium-server-1.0.3 under selenium-remote-control-1.0.3 in cmd,

Run the Java-jar selenium-server.jar to start.


 

For convenience, you can create a batch file to start selenium-server. My batch file:

Java-jar D: \ selenium-remote-control-1.0.3 \ selenium-server-1.0.3 \ selenium-server.jar


Run the test class !!

The following result is displayed, indicating that the operation is successful !!




                                                                                                                                                                                                                                                                           

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.