51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 6680|回复: 4

sessionId should not be null; has this session been started yet?

[复制链接]

该用户从未签到

发表于 2010-5-18 15:11:18 | 显示全部楼层 |阅读模式
我在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
回复

使用道具 举报

该用户从未签到

 楼主| 发表于 2010-5-18 15:49:42 | 显示全部楼层

以上是我用selenium+testng时出错滴,,求助呀!!

以上是我用selenium+testng做自动化测试出错滴!

首先我安装了testng插件,然后新建project,在project的build path里面加入了 junit4,testng 和 selenium-java-client jar文件。
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2010-5-18 17:36:02 | 显示全部楼层
你要在open上面加selenium.start()
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2010-5-19 11:34:09 | 显示全部楼层
启动不正常,SessionId是空的
回复 支持 反对

使用道具 举报

该用户从未签到

发表于 2010-6-7 21:01:29 | 显示全部楼层
3 l +1, 我也经常忘写selenium.start()
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-3-29 12:39 , Processed in 0.076405 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表