TA的每日心情 | 难过 2015-1-21 11:13 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
代码如下:
package com.test;
import junit.framework.Assert;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
public class test {
//private Selenium selenium;
SeleniumServer SELENIUM_SERVER;
private Selenium selenium;
@Before
public void setUp() throws Exception {
/* RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setPort(4444); //指定selenium server 开放端口
SELENIUM_SERVER = new SeleniumServer(rcc);
SELENIUM_SERVER.start(); //测试前启动server*/
selenium = new DefaultSelenium("localhost", 4444, "*firefox C:/Program Files (x86)/Mozilla Firefox/firefox.exe"/*"*iexplore"*/, "http://www.baidu.com/");
selenium.start();
}
@Test
public void testTest() throws Exception {
selenium.open("/");
// selenium.click("id=kw");
// selenium.type("id=kw", "123");
// selenium.click("id=su");
// selenium.waitForPageToLoad("30000");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
只出现这样的界面
|
|