selenium rc java_selenium笔记一--selenium RC+JAVA环境搭建

3.选择options—format,选择java /Junit4/remote control ,选择工作区中的source标签,即显示java脚本51Testing软件测试网5^,_{8Ke@5o$~h

.F#HY2H,H.lS,u(e0

脚本如下,只需修改一下红色部分,即可在Eclipse里运行"w;\J6U9g,D[0

package text.package;-`J/t8t#IS6X0

z$t0b}A;gc%K0

import com.thoughtworks.selenium.*;51Testing软件测试网5R)A QA"p/yq}

import org.junit.After;DxV1GV| g:C(I0

import org.junit.Before;51Testing软件测试网s#Rz1Z2M"W }3WE

import org.junit.Test;51Testing软件测试网G#pC:U9f

import java.util.regex.Pattern;)xZly%{

KF0

W3R!gu?/L6Dv0

public class ClsTestextends SeleneseTestCase{Ql

ap#gs8U2i0

@Before?mIgDP1?0

public void setUp() throws Exception {51Testing软件测试网h2u`0dc_

selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.baidu.com/");51Testing软件测试网nl6Ok(gS

selenium.start();P,B^&FTuV0

}+w2O4]FV5d\0

51Testing软件测试网2PSI]4Z;}(V2}

@Test%^g-kw$\x(ko0

public void testTest1() throws Exception {!M+D/h`(r}-o`M0

selenium.open("http://www.baidu.com/");51Testing软件测试网,YG%Za X.`y

selenium.type("id=kw", "12");51Testing软件测试网rQ-C'B3n(y

selenium.click("id=su");#W;U|7a;uXhV0

selenium.waitForPageToLoad("30000");,Nl w

|t0

}51Testing软件测试网3j(e]|/[s{:[?

T!I[QXN0

@AfterZ6V/M#o q0

public void tearDown() throws Exception {J$?3[EqwQm0

selenium.stop();51Testing软件测试网!VpR1u$F

h0pv

}_Oj z%@~*e5_9q0

}51Testing软件测试网#bK&O-I9i5L

4.eclipse新建工程,新建package名称为text.package;新建class为ClsTest,工程属性-Java build path-Add liarbry,添加Junit4。Pu;p4X2Q3d3k-y6PB0

Add external JARS,把selenium-server-standalone-2.25.0.jar、51Testing软件测试网(k4yJ0v_*Zmb

selenium-java-2.25.0.jar添加进来51Testing软件测试网o'e:y*E{(^l

将之前的脚本复制到ClsTest.Java中]T$Cv0{*Bj_.g0

5.启动rc51Testing软件测试网`_%?M6G?R

Cmd进入到selenium-server-standalone-2.25.0.jar所在目录51Testing软件测试网8X}%v?t#y]

输入Java–jar selenium-server-standalone-2.25.0.jar,启动后cmd窗口不能关闭,否则就是停止了51Testing软件测试网5mB%N@ I CKxVD

可以写个批处理来运行rc server(可以使用Java–jar selenium-server-standalone-2.25.0.jar–interactive来交互式启动rc server)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值