TA的每日心情 | 奋斗 2015-3-30 15:24 |
---|
签到天数: 3 天 连续签到: 1 天 [LV.2]测试排长
|
本帖最后由 fsweicaixia 于 2013-11-26 16:13 编辑
初学,代码如下:package org.coderinfo.demo;
import com.thoughtworks.selenium.*;
@SuppressWarnings("deprecation")
public class TestEnv extends SeleneseTestCase {
public void setUp()throws Exception {
// setUp("http://www.baidu.com","googlechrome");
System.out.print("----开始执行-----");
selenium=new DefaultSelenium("192.168.13.10",8001,"*googlechrome","http://192.168.13.10:8001/login.aspx");
selenium.start();
}
public void testUntitled()throws Exception{
selenium.open("/");
selenium.type("q", "selenium");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
boolean testResult = (selenium.isTextPresent("Selenium web application testing system"));
if (testResult){
//用例成功
System.out.print("Search selenium web is ok!");
} else {
//用例失败
System.out.print("selenium web not found!");
}
}
public static void main(String[] args) throws Exception {
TestEnv st = new TestEnv();
st.setUp();
st.testUntitled();
}
}
----开始执行-----
Exception in thread "main" java.lang.RuntimeException: Could not start Selenium session: Not Found
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
at org.coderinfo.demo.TestEnv.setUp(TestEnv.java:9)
at org.coderinfo.demo.TestEnv.main(TestEnv.java:28)
Caused by: com.thoughtworks.selenium.SeleniumException: Not Found
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:112)
at com.thoughtworks.selenium.HttpCommandProcessor.getCommandResponseAsString(HttpCommandProcessor.java:183)
at com.thoughtworks.selenium.HttpCommandProcessor.executeCommandOnServlet(HttpCommandProcessor.java:118)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:101)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:275)
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:237)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
... 2 more
此问题是否因找不到包
还有是否要启动selenium-server.jar包 |
|