|
import junit.framework.TestCase;
import com.thoughtworks.selenium.*;
public class Test extends TestCase {
private Selenium selenium;
public void setUp() throws Exception {
String url = "http://www.google.com";
selenium = new DefaultSelenium("localhost", 4444, "*firefox", url); //4444 is default server port
selenium.start();
}
protected void tearDown() throws Exception {
// selenium.stop();
}
public void testGoogle() throws Throwable {
selenium.open("http://www.google.com/webhp?hl=en");
assertEquals("Google", selenium.getTitle());
selenium.type("q", "Selenium OpenQA");
assertEquals("Selenium OpenQA", selenium.getValue("q"));
selenium.click("btnG");
selenium.waitForPageToLoad("5000");
assertEquals("Selenium OpenQA - Google Search", selenium.getTitle());
}
}
这个脚本在别人的机器上跑是正常的,所以我想应该脚本没有什么问题 |
|