|
5#
楼主 |
发表于 2016-1-22 14:51:37
|
只看该作者
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestCase;
import java.util.regex.Pattern;
public class Open extends SeleneseTestCase {
public void setUp() throws Exception {
// selenium = new DefaultSelenium("localhost", 4444, "C:\\Program Files\\Firefox20_9ht\\Mozilla\\FirefoxLoader.exe", "http://www.baidu.com/");
selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "http://www.baidu.com/");
// new DefaultSelenium(
// "localhost", 440, "*firefox C:\\Program Files\\Firefox20_9ht\\Mozilla\\FirefoxLoader.exe”, “http://www.baidu.com/", null);\
// selenium = new DefaultSelenium("localhost", 4484, "*firefox", "http://change-this-to-the-site-you-are-testing/");
//这里如果运行不了,修改浏览器为 *firefox 或 *iexplore
selenium.start();
}
public void testTest() throws Exception {
//selenium.open("/index.html"); 可以增加页面类型
//selenium.windowsMaximize(); 将来浏览器窗口放大
selenium.type("id=kw", "selenium");
selenium.click("id=su");
//selenium.waitForPageToLoad("30000");
}
public void tearDown() throws Exception {
selenium.stop();
}
} |
|