Package net.sf.sahi.session

Examples of net.sf.sahi.session.Session


        return new NoCacheHttpResponse(s);
    }

    public HttpResponse auto2(final HttpRequest request) {
      ProcessHelper.setProcessStarted();
        Session session = request.session();
        String fileName = request.getParameter("file");

        final String scriptFileWithPath;
        scriptFileWithPath = fileName;
        RhinoScriptRunner scriptRunner = new RhinoScriptRunner(new FileScript(scriptFileWithPath));
    session.setScriptRunner(scriptRunner);
    session.setIsPlaying(true);
        String startUrl = request.getParameter("startUrl");
        session.setIsWindowOpen(false);
        startPlayback(session, true, "0");
        return proxyAutoResponse(startUrl, session.id());
    }
View Full Code Here


        return proxyAutoResponse(startUrl, session.id());
    }

    public HttpResponse auto(final HttpRequest request) {
      ProcessHelper.setProcessStarted();
        Session session = request.session();
        String startUrl = request.getParameter("startUrl");
        session.setIsWindowOpen(false);
        session.setIsPlaying(true);
        session.setVariable("isSingleSession", request.getParameter("isSingleSession"));
        return proxyAutoResponse(startUrl, session.id());
    }
View Full Code Here

        return proxyAutoResponse(startUrl, session.id());
    }

    public HttpResponse autoJava(final HttpRequest request) {
      ProcessHelper.setProcessStarted();
        Session session = request.session();
        String startUrl = request.getParameter("startUrl");
        session.setIsWindowOpen(false);
        session.removeVariables(".*");
        session.setIsReadyForDriver(false); // will be toggled in Driver_initialized
        return proxyAutoResponse(startUrl, session.id());
    }
View Full Code Here

      ScriptRunner scriptRunner = request.session().getScriptRunner();
      return new SimpleHttpResponse("" + scriptRunner.hasErrors());
    }
   
    public void xsuccess(final HttpRequest request) {
        Session session = request.session();
        session.touch();
        SessionState state = new SessionState();
        state.setVar("sahi_retries", "0", session);
        state.setVar("sahi_not_my_win_retries", "0", session);
    }
View Full Code Here

    public HttpResponse ping(final HttpRequest request) {
      return new SimpleHttpResponse(request.session().getInfoJSON());
    }
   
    public HttpResponse isPlaying(final HttpRequest request){
      Session session = request.session();
        return new SimpleHttpResponse(session.isPlaying() ? "1" : "0");     
    }  
View Full Code Here

    props.setProperty("domainInfo", domainFixInfo);
    return new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/domainfix.js", props, false, true);
    }
   
    public HttpResponse isRecording(final HttpRequest request){
      Session session = request.session();
        return new SimpleHttpResponse(session.isRecording() ? "1" : "0");     
    }
View Full Code Here

    System.out.println(states);
    request.session().setXHRReadyStatesToWaitFor(states);
  }
   
    public HttpResponse execute(final HttpRequest request) {
        Session session = request.session();
        Properties props = new Properties();
        props.setProperty("sessionId", session.id());
        props.setProperty("isWindowOpen", "" + session.isWindowOpen());
        props.setProperty("isSahiPaused", "" + session.isPaused());
        props.setProperty("isSahiPlaying", "" + session.isPlaying());
        props.setProperty("isSahiRecording", "" + session.isRecording());
        props.setProperty("hotkey", "" + Configuration.getHotKey());

        props.setProperty("interval", "" + Configuration.getTimeBetweenSteps());
        props.setProperty("onErrorInterval", "" + Configuration.getTimeBetweenStepsOnError());
        props.setProperty("maxRetries", "" + Configuration.getMaxReAttemptsOnError());
        props.setProperty("maxWaitForLoad", "" + Configuration.getMaxCyclesForPageLoad());
        props.setProperty("strictVisibilityCheck", "" + Configuration.isStrictVisibilityCheckEnabled());
        props.setProperty("waitReadyStates", getXHRReadyStatesToWaitFor(session));
        props.setProperty("controllerMode", "" + Configuration.getControllerMode());
        props.setProperty("escapeUnicode", "" + Configuration.getEscapeUnicode());
        props.setProperty("commonDomain", "" + Configuration.getCommonDomain());
        props.setProperty("chromeExplicitCheckboxRadioToggle", "" + Configuration.getChromeExplicitCheckboxRadioToggle());
        props.setProperty("ignorableIdsPattern", Configuration.getIgnorableIdsPattern());
        props.setProperty("strictVisibilityCheck", "" + session.getVariable("strictVisibilityCheck"));
        props.setProperty("isSingleSession""" + session.getVariable("isSingleSession"));

        String waitCondition = session.getVariable("waitCondition");
        if (Utils.isBlankOrNull(waitCondition)) {
            waitCondition = "";
        }
        props.setProperty("waitCondition", "" + Utils.escapeDoubleQuotesAndBackSlashes(waitCondition));
        String waitTime = session.getVariable("waitConditionTime");
        if (Utils.isBlankOrNull(waitTime)) {
            waitTime = "-1";
        }
        props.setProperty("waitConditionTime", "" + waitTime);
        props.setProperty("stabilityIndex", "" + Configuration.getStabilityIndex());
        ScriptRunner scriptRunner = session.getScriptRunner();
        if (scriptRunner != null && scriptRunner.getScript() != null){
      props.setProperty("scriptPath", Utils.escapeDoubleQuotesAndBackSlashes(Utils.escapeDoubleQuotesAndBackSlashes(scriptRunner.getScript().getFilePath())));
          props.setProperty("scriptName", scriptRunner.getScriptName());
        }else{
      props.setProperty("scriptPath", "");
View Full Code Here

        addSahisidCookie(httpResponse, session);
        return httpResponse;
    }

    public void setVar(final HttpRequest request) {
        Session session = request.session();
        String name = request.getParameter("name");
        String value = request.getParameter("value");
        boolean append = "1".equals(request.getParameter("append"));
        Hits.increment("SessionState_setVar :: " + name);
        if (setVarOnSuite(request)){
          SahiTestSuite suite = request.session().getSuite();
          if (append) {
            String val = suite.getVariable(name);
            if (val != null) value = val + " + " + value;
          }
      suite.setVariable(name, value);
        } else {
          if (append) {
            String val = session.getVariable(name);
            if (val != null) value = val + " + " + value;
          }
          setVar(name, value, session);
    }
    }
View Full Code Here

    public void setVar(final String name, final String value, final Session session) {
        session.setVariable(name, value);
    }

    public HttpResponse getVar(final HttpRequest request) {
        Session session = request.session();
        HttpResponse httpResponse;
        String name = request.getParameter("name");
        Hits.increment("SessionState_getVar :: " + name);
        boolean isDelete = "1".equals(request.getParameter("isdelete"));
        String value = null;
        if (setVarOnSuite(request)){
          SahiTestSuite suite = request.session().getSuite();
      value = suite.getVariable(name);
          if (isDelete) suite.setVariable(name, null)
        } else{
          value = session.getVariable(name);
          if (isDelete) session.setVariable(name, null);
        }
        httpResponse = new NoCacheHttpResponse(value != null
                ? Utils.encode(value)
                : "null");
        return httpResponse;
View Full Code Here

        httpResponse.resetRawHeaders();
        return httpResponse;
    }
   
    public void setCredentials(HttpRequest request){
        Session session = request.session();
        session.addRequestCredentials(request.getParameter("authRealm"),
            request.getParameter("authUser"), request.getParameter("authPassword"));
    }   
View Full Code Here

TOP

Related Classes of net.sf.sahi.session.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.