人的差别在于业余时间,而一个人的命运决定于晚上8点到10点之间。
北京安全测试精英QQ群:164265622 北京白盒测试精英QQ群:164265999
北京性能测试精英QQ群:164266156 北京自动化测试精英群:212723528
北京软件测试精英QQ群:86920845
junit使用selenium步骤
上一篇 /
下一篇 2011-12-30 12:27:42
/ 个人分类:自动化测试
1.安装JDK
2.安装eclipse
3.JAR包,导入:selenium-java-2.13.0-客户端.jar , selenium-server-服务.jar,JUNIT 4 包
4.命令行,启动服务器端: java -jar selenium-server.jar
5.eclipse中,新建JAVA项目,然后建立junit类,写如下代码:
import com.thoughtworks.selenium.*;
import com.thoughtworks.selenium.DefaultSelenium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
public class Open {
Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium ("localhost", 4444, "*iexplore", "http://www.baidu.com/");
selenium.start();
}
@Test
public void testTest() throws Exception {
selenium.open("/"); //selenium.open("/index.html"); 可以增加页面类型
selenium.windowMaximize();//将浏览器窗口放大
selenium.type("id=kw", "selenium");
selenium.click("id=su");
selenium.waitForPageToLoad("800000");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
收藏
举报
TAG: