WebContext contex = WebContextFactory.get();  
Collection<ScriptSession> sessions = contex.getScriptSessionsByPage("/LSEC/pages/index.jsp");
System.out.prinln(sessions);为什么得到的sessions为空呢,输出的结果为[],求大神帮忙解决啊!

解决方案 »

  1.   

    getScriptSessionsByPage@Deprecated
    java.util.Collection<ScriptSession> getScriptSessionsByPage(java.lang.String url)
    Deprecated. Use Browser.withPage(String, Runnable) instead
    Get a list of all ScriptSessions on a given page. Note that the list of known sessions is continually changing so it is possible that the list will be out of date by the time it is used. For this reason you should check that getScriptSession(String id) returns something non null.
    Parameters:
    url - The URL including 'http://', up to (but not including) '?' or '#'
    Returns:
    A collection of all the ScriptSessions.
    可以看到这个方法以后废弃不用了,用也是可以的,但是你的url不对,参数说明里要包含http://才行,加上你的本地路径看看,相对于tomcat