51Testing软件测试论坛

标题: sessionId should not be null; has this session been started yet? [打印本页]

作者: yimaotao    时间: 2010-5-18 15:11
标题: sessionId should not be null; has this session been started yet?
我在debug一下代码的时候出现了错误:

import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;

public class sample extends SeleneseTestNgHelper{
        Selenium selenium;
        @Test public void testUntitled() throws Exception {
                selenium=new DefaultSelenium("localhost", 4444, "*firefox", "http://www.swpu.edu.cn");  
                selenium.open("/");
                selenium.click("link=软件学院第三届董事会第一次会议召开");
                selenium.waitForPageToLoad("30000");
                selenium.click("link=首页");
                selenium.waitForPageToLoad("30000");
        }
}



错误:


FAILED: testUntitled
com.thoughtworks.selenium.SeleniumException: ERROR Server Exception: sessionId should not be null; has this session been started yet?
        at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
        at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
        at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
        at sample.testUntitled(sample.java:11)
... Removed 22 stack frames

===============================================
    sample
    Tests run: 1, Failures: 1, Skips: 0

作者: yimaotao    时间: 2010-5-18 15:49
标题: 以上是我用selenium+testng时出错滴,,求助呀!!
以上是我用selenium+testng做自动化测试出错滴!

首先我安装了testng插件,然后新建project,在project的build path里面加入了 junit4,testng 和 selenium-java-client jar文件。
作者: wugecat    时间: 2010-5-18 17:36
你要在open上面加selenium.start()
作者: SZFrank2007    时间: 2010-5-19 11:34
启动不正常,SessionId是空的
作者: goal1860    时间: 2010-6-7 21:01
3 l +1, 我也经常忘写selenium.start()




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2