第二章 构建项目

 

1、下载elenium-remote-control

地址:http://release.seleniumhq.org/selenium-remote-control/

作者下载的版本是:selenium-remote-control-1.0.3

此处可以获取:

http://code.google.com/p/selenium/downloads/detail?name=selenium-remote-control-1.0.3.zip&can=2&q=

解压之后,有如下文件目录

wps_clip_image-2878

2、运行selenium-remote-control

进入cmd命令行:

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

结果如图:wps_clip_image-32564

3、构建eclipse项目

除了添加Junit4支持,还需要添加两个jar包:

wps_clip_image-2164

这两个可以在之前的目录中找到

selenium-java-client-driver-1.0.1

4、运行测试用例

代码:

import org.junit.After;

import org.junit.Before;

import org.junit.Test;

import com.thoughtworks.selenium.DefaultSelenium;

import com.thoughtworks.selenium.SeleneseTestCase;

public class JoobenTest extends SeleneseTestCase {

@Before

public void setUp() throws Exception {

selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://jooben.blog.51cto.com/");

selenium.start();

    }

@Test

public void testUntitled() throws Exception {

selenium.open("/");

verifyTrue(selenium.isTextPresent("生活琐记"));

    }

@After

public void tearDown() throws Exception {

selenium.stop();

    }

}

wps_clip_image-16440

测试通过:

wps_clip_image-21905

你可能感兴趣的:(职场,项目,休闲,blank)