Class Response


  • public class Response
    extends java.lang.Object
    Describes an HTTP response returned by a web server. When a Request is sent to the server, then a corresponding Response object will be generated.

    e.g.

    
     Request request1 = getWebBrowser().createRequest(HttpMethod.GET, new Url("http://www.testplant.com/"), 1); 
     Response response1 = request1.send(); 
     
    The Response object contains information about the response from the web server, such as the HTTP status code, the HTTP response headers, and the actual content of the response. The response may also contain sub-responses, such as images, CSS files, or javascript. These can be accessed using the getSubResponses() method.
    See Also:
    Request
    • Constructor Summary

      Constructors 
      Constructor Description
      Response​(long cPtr, boolean cMemoryOwn)
      For internal use only.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsHeader​(java.lang.String header)
      Returns true if this Response contains a particular HTTP response header.
      void delete()  
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, ActionType failAction)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying what action to take in case of failure.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and specifying what action to take in case of failure.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, SearchFlags matchFlags)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, SearchFlags matchFlags, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, java.lang.String defaultValue)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found.
      java.lang.String extract​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(ExtractionCursor cursor, java.util.List<java.lang.String> before, java.lang.String after)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found.
      java.lang.String extract​(ExtractionCursor cursor, java.util.List<java.lang.String> before, java.lang.String after, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(ExtractionCursor cursor, java.util.List<java.lang.String> before, java.lang.String after, ActionType failAction)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, and specifying what action to take in case of failure.
      java.lang.String extract​(ExtractionCursor cursor, java.util.List<java.lang.String> before, java.lang.String after, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and what action to take in case of failure.
      java.lang.String extract​(ExtractionCursor cursor, java.util.List<java.lang.String> before, java.lang.String after, java.lang.String defaultValue)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found.
      java.lang.String extract​(ExtractionCursor cursor, java.util.List<java.lang.String> before, java.lang.String after, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(java.lang.String before, java.lang.String after)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found.
      java.lang.String extract​(java.lang.String before, java.lang.String after, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(java.lang.String before, java.lang.String after, ActionType failAction)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying what action to take in case of failure.
      java.lang.String extract​(java.lang.String before, java.lang.String after, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and specifying what action to take in case of failure.
      java.lang.String extract​(java.lang.String before, java.lang.String after, java.lang.String defaultValue)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found.
      java.lang.String extract​(java.lang.String before, java.lang.String after, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(java.util.List<java.lang.String> before, java.lang.String after)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found.
      java.lang.String extract​(java.util.List<java.lang.String> before, java.lang.String after, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extract​(java.util.List<java.lang.String> before, java.lang.String after, ActionType failAction)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and what action to take in case of failure.
      java.lang.String extract​(java.util.List<java.lang.String> before, java.lang.String after, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and what action to take in case of failure.
      java.lang.String extract​(java.util.List<java.lang.String> before, java.lang.String after, java.lang.String defaultValue)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found.
      java.lang.String extract​(java.util.List<java.lang.String> before, java.lang.String after, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive.
      Form extractForm​(int formIndex)
      Extracts the nth HTML Form from the response content.
      Form extractForm​(int formIndex, ActionType failAction)
      Extracts the nth HTML Form from the response content, and takes the specified failAction if no matching form can be found.
      Form extractForm​(java.lang.String formName)
      Extracts an HTML Form with the specified formName from the response content.
      Form extractForm​(java.lang.String formName, ActionType failAction)
      Extracts an HTML Form with the specified formName from the response content, and takes the specified failAction if no matching form can be found.
      java.util.List<Form> extractForms()
      Extracts all the HTML Form objects from the response content.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, boolean caseSensitive)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, ActionType failAction)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, ActionType failAction, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, java.lang.String defaultValue)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.lang.String after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, boolean caseSensitive)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, ActionType failAction)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, ActionType failAction, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, java.lang.String defaultValue)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(ExtractionCursor cursor, java.util.List<java.lang.String> after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, boolean caseSensitive)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, ActionType failAction)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, ActionType failAction, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, java.lang.String defaultValue)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.lang.String after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content, starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, boolean caseSensitive)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, ActionType failAction)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, ActionType failAction, boolean caseSensitive)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, ActionType failAction, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, java.lang.String defaultValue)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive)
      Extracts text from the response content starting from the end.
      java.lang.String extractFromEnd​(java.util.List<java.lang.String> after, java.lang.String before, java.lang.String defaultValue, boolean caseSensitive, SearchFlags matchFlags)
      Extracts text from the response content starting from the end.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, SearchFlags matchFlags)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, SearchFlags matchFlags, java.lang.String endAt)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, SearchFlags matchFlags, java.lang.String endAt, boolean caseSensitive)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, SearchFlags matchFlags, java.lang.String endAt, boolean caseSensitive, int maxItems)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, java.lang.String endAt)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, java.lang.String endAt, boolean caseSensitive)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(ExtractionCursor cursor, java.lang.String before, java.lang.String after, java.lang.String endAt, boolean caseSensitive, int maxItems)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(java.lang.String before, java.lang.String after)
      Extracts a list of items from this Response.
      java.util.List<java.lang.String> extractList​(java.lang.String before, java.lang.String after, boolean caseSensitive)
      Extracts a list of items from this Response, specifying whether the search should be case-sensitive.
      java.util.List<java.lang.String> extractList​(java.lang.String before, java.lang.String after, boolean caseSensitive, int maxItems)
      Extracts a list of items from this Response, specifying whether the search should be case-sensitive, and the maximum number of items to extract.
      RegExpMatchList extractRegExp​(ExtractionCursor cursor, java.lang.String regExp)
      Extracts multiple String objects from the response content, wherever the specified regular expression matches.
      RegExpMatchList extractRegExp​(ExtractionCursor cursor, java.lang.String regExp, boolean caseSensitive)
      Extracts multiple String objects from the response content, wherever the specified regular expression matches, and specifying whether the search will be case-sensitive.
      java.lang.String extractRegExp​(ExtractionCursor cursor, java.lang.String beforeRegExp, java.lang.String afterRegExp, SearchFlags matchFlags)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found.
      java.lang.String extractRegExp​(ExtractionCursor cursor, java.lang.String beforeRegExp, java.lang.String afterRegExp, SearchFlags matchFlags, boolean caseSensitive)
      Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.
      java.lang.String extractXPath​(java.lang.String xpathExpression, ActionType failAction)
      Returns a string object from the HTML or XML response content that matches the given XPath expression.
      boolean find​(ExtractionCursor cursor, java.lang.String text)
      Finds the specified text within this Response.
      boolean find​(ExtractionCursor cursor, java.lang.String text, boolean caseSensitive)
      Finds the specified text within this Response, specifying whether the search will be case-sensitive.
      boolean find​(ExtractionCursor cursor, java.lang.String text, ActionType failAction)
      Finds the specified text within this Response, specifying what action to take in case of failure.
      boolean find​(ExtractionCursor cursor, java.lang.String text, ActionType failAction, boolean caseSensitive)
      Finds the specified text within this Response, specifying whether the search will be case-sensitive, and what action to take in case of failure.
      Url getAnchor​(int n, ActionType failAction)
      Gets the nth anchor in this Response.
      long getBytesDownloaded()
      Gets the number of bytes downloaded from the server.
      java.lang.String getCharEncoding()
      Gets the character encoding that is used to decode the data contained in this Response, for example "UTF-8".
      java.lang.String getCharSet()
      Gets the value of the "charset" parameter specified in the "Content-Type" HTTP response header.
      java.lang.String getContent()
      Gets the content of this Response, using the current encoding (as defined by getCharEncoding()) to decode the data.
      org.json.simple.JSONObject getContentAsJson()
      Gets an org.json.simple JSON object representation of this Response.
      org.w3c.dom.Document getContentAsXml()
      Gets an XML DOM representation of this Response.
      java.lang.String getContentEncoding()
      Gets the value of the "Content-Encoding" HTTP response header.
      long getContentLength()
      Gets the length in bytes of the response content.
      java.lang.String getContentType()
      Gets the value of the "Content-Type" HTTP response header.
      static long getCPtr​(Response obj)
      For internal use only.
      java.util.List<java.lang.String> getHeaderKeys()
      Gets a list of names of all the HTTP response headers set in this Response.
      java.lang.String getHeaderValue​(java.lang.String header)
      Gets the value of an HTTP response header contained in this Response.
      java.lang.String getHeaderValue​(java.lang.String header, int index)
      Gets the value of the nth instance of an HTTP response header contained in this Response.
      java.lang.String getMessageBody()
      Gets the body of the message from the corresponding Request.
      HttpMethod getMethod()
      Gets the HttpMethod that was used to send the Request.
      byte[] getRawContent()
      Gets the raw content of this Response.
      int getReceiveTime()
      Gets the time at which the response was received from the server (measured in milliseconds since the start of the test).
      Response getRedirectedFrom()
      Gets the Response from which this Response has been redirected.
      Response getRedirectedFrom​(int depth)
      Gets the Response from which this Response has been redirected.
      java.lang.String getReferer()
      Gets the value of the "Referer" HTTP response header.
      HttpStatus getResult()
      Gets the HTTP status code received from the server when this Response was served.
      java.lang.String getResultString()
      Gets the HTTP result returned by the server, e.g. HTTP/1.1 200 OK
      int getSendTime()
      Gets the time at which the request was sent to the server (measured in milliseconds since the start of the test).
      java.util.List<Response> getSubResponses()
      Gets a list of Response objects that describe HTTP responses to sub-requests associated with the top-level Request sent to the web server.
      java.lang.String getTitle()
      Gets the HTML title of this Response.
      Url getUrl()
      Gets the Url that was used in the corresponding Request.
      java.lang.String getUrlString()
      Gets the URL that was used in the corresponding Request, as a String.
      java.lang.String getUserAgent()
      Gets the value of the "User-Agent" HTTP response header.
      java.lang.String getVersion()
      Get the version of HTTP that was used to send this response
      boolean hasReferer()
      Returns true if this Response contains an HTTP "Referer" response header.
      boolean hasTitle()
      Returns true if this Response contains an HTML title.
      void resetCharEncoding()
      Resets the character encoding that is used to decode the data contained in this Response.
      boolean rfind​(ExtractionCursor cursor, java.lang.String text)
      Finds the specified text within this Response, starting from the end of the content.
      boolean rfind​(ExtractionCursor cursor, java.lang.String text, boolean caseSensitive)
      Finds the specified text within this Response, starting from the end of the content, and specifying whether the search will be case-sensitive.
      boolean rfind​(ExtractionCursor cursor, java.lang.String text, ActionType failAction)
      Finds the specified text within this Response, starting from the end of the content, specifying what action to take in case of failure.
      boolean rfind​(ExtractionCursor cursor, java.lang.String text, ActionType failAction, boolean caseSensitive)
      Finds the specified text within this Response, starting from the end of the content, specifying whether the search will be case-sensitive, and what action to take in case of failure.
      void setCharEncoding​(java.lang.String charEncoding)
      Sets the character encoding that is used to decode the data contained in this Response.
      boolean verifyContains​(java.lang.String text)
      Returns true if the content of this Response contains the specified text.
      boolean verifyContains​(java.lang.String text, boolean caseSensitive)
      Returns true if the content of this Response contains the specified text, specifying whether the search will be case-sensitive.
      boolean verifyContains​(java.lang.String text, ActionType failAction)
      Returns true if the content of this Response contains the specified text, specifying what action to take in case of failure.
      boolean verifyContains​(java.lang.String text, ActionType failAction, boolean caseSensitive)
      Returns true if the content of this Response contains the specified text, specifying whether the search will be case-sensitive, and what action to take in case of failure.
      boolean verifyResult​(HttpStatus expectedResult)
      Verify that the response code of this Response matches the specified expectedResult.
      boolean verifyResult​(HttpStatus expectedResult, ActionType action)
      Verify that the response code of this Response matches the specified expectedResult, and takes the specified action if it does not.
      boolean verifyTitle​(java.lang.String title)
      Verifies that the title of this Response page matches the specified title.
      boolean verifyTitle​(java.lang.String title, ActionType action)
      Verifies that the title of this Response page matches the specified title, and takes the specified action if it does not.
      boolean wasRedirected()
      Returns true if this Response was the result of a redirected request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Response

        public Response​(long cPtr,
                        boolean cMemoryOwn)
        For internal use only. Of no interest to the user.
        Parameters:
        cPtr - pointer to the CPP wrapped object
        cMemoryOwn - indicates if this object is responsible for memory management of the CPP object
    • Method Detail

      • getCPtr

        public static long getCPtr​(Response obj)
        For internal use only. Of no interest to the user.
        Parameters:
        obj - a reference to an object of this class
        Returns:
        a long containing the address of the CPP wrapped object
      • delete

        public void delete()
      • getMethod

        public HttpMethod getMethod()
                             throws java.lang.Exception
        Gets the HttpMethod that was used to send the Request.

        e.g.

        
         Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1, 1);
         Response response1 = request1.send();
        
         HttpMethod method = response1.getMethod(); // method will be HttpMethod.GET
         
        Returns:
        the HttpMethod that was used in the Request
        Throws:
        java.lang.Exception - an internal error occurred
      • getUrl

        public Url getUrl()
        Gets the Url that was used in the corresponding Request.

        e.g.

        
         Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1, 1);
         Response response1 = request1.send();
        
         Url url2 = response1.getUrl(); // url2 == url1
         
        Returns:
        the Url used in the corresponding Request
        See Also:
        getUrlString()
      • getRedirectedFrom

        public Response getRedirectedFrom()
        Gets the Response from which this Response has been redirected.

        If a request returns a redirect response code (e.g. 301 or 302), then eggPlant Performance will automatically follow the redirect, and the Response object returned from Request.send() will be the final destination (assuming Request.setFollowRedirects(boolean) has been set to true). In this situation, this method can be used to examine the earlier responses in the redirect chain.

        e.g.

        
         Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1, 1);
         Response response1 = request1.send();
        
         if (response1.wasRedirected())
         {
             Response redirectedResponse = response1.getRedirectedFrom();
             ...
         }
         
        If the request was not redirected, then this method returns null.
        Returns:
        the Response which this Response has been redirected from, or null if no redirection occurred
        See Also:
        wasRedirected(), Request.setFollowRedirects(boolean), WebBrowser.setDefaultFollowRedirects(boolean)
      • getRedirectedFrom

        public Response getRedirectedFrom​(int depth)
        Gets the Response from which this Response has been redirected.

        If a request returns a redirect response code (e.g. 301 or 302), then eggPlant Performance will automatically follow the redirect, and the Response object returned from Request.send() will be the final destination (assuming Request.setFollowRedirects(boolean) has been set to true). In this situation, this method can be used to examine the earlier responses in the redirect chain.

        e.g.

        
         Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1, 1);
         Response response1 = request1.send();
        
         if (response1.wasRedirected())
         {
             Response redirectedResponse = response1.getRedirectedFrom(2);
             ...
         }
         
        If the request was not redirected, then this method returns null.
        Parameters:
        depth - how far to traverse up the redirect chain
        Returns:
        the Response which this Response has been redirected from, or null if no redirection occurred
        See Also:
        wasRedirected(), Request.setFollowRedirects(boolean), WebBrowser.setDefaultFollowRedirects(boolean)
      • getUrlString

        public java.lang.String getUrlString()
        Gets the URL that was used in the corresponding Request, as a String.

        e.g.

        
         Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1, 1);
         Response response1 = request1.send();
        
         String urlString = response1.getUrlString(); // urlString == url1.toString()
         
        Returns:
        the URL used in the corresponding Request
        See Also:
        getUrl()
      • getMessageBody

        public java.lang.String getMessageBody()
        Gets the body of the message from the corresponding Request. For example, if this object is a response to a POST request, then this method will return the POST data that was sent.

        e.g.

        
         request.setMessageBody("my post data");
         Response response = request.send();
         String postData = response.getMessageBody(); // postData == "my post data"
         
        Returns:
        the body of the message
        See Also:
        Request.setMessageBody(java.lang.String)
      • getResult

        public HttpStatus getResult()
        Gets the HTTP status code received from the server when this Response was served. The most common status code is 200 OK, although other codes between 200 and 299 also indicate success.

        e.g.

        
         if (!response.getResult().isSuccess())
         {
             error(response.getResultString());
         }
         
        Returns:
        the HTTP status code received from the server
      • getResultString

        public java.lang.String getResultString()
        Gets the HTTP result returned by the server, e.g. HTTP/1.1 200 OK
        Returns:
        the HTTP result
        See Also:
        getResult()
      • wasRedirected

        public boolean wasRedirected()
        Returns true if this Response was the result of a redirected request. If this method returns true, then a call to getRedirectedFrom() will succeed.

        e.g.

        
         Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1, 1);
         Response response1 = request1.send();
         
         if (response1.wasRedirected())
         {
             Response redirectedResponse = response1.getRedirectedFrom();
             ...
         }
         
        Returns:
        true if the request was redirected
        See Also:
        getRedirectedFrom()
      • containsHeader

        public boolean containsHeader​(java.lang.String header)
                               throws java.io.UnsupportedEncodingException
        Returns true if this Response contains a particular HTTP response header.

        e.g.

        
         if (response.containsHeader("Last-Modified"))
         {
             String lastModified = response.getHeaderValue("Last-Modified");
             ...
         }
         
        Parameters:
        header - the header to check for
        Returns:
        true if this Response contains the specified header
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        See Also:
        getHeaderValue(java.lang.String)
      • getHeaderValue

        public java.lang.String getHeaderValue​(java.lang.String header)
                                        throws java.io.UnsupportedEncodingException
        Gets the value of an HTTP response header contained in this Response.

        e.g.

        
         if (response.containsHeader("Last-Modified"))
         {
             String lastModified = response.getHeaderValue("Last-Modified");
             ...
         }
         
        Parameters:
        header - the HTTP response header to look for
        Returns:
        the value of the header, or an empty String if the header does not exist
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        See Also:
        containsHeader(java.lang.String), getHeaderValue(String, int)
      • getHeaderValue

        public java.lang.String getHeaderValue​(java.lang.String header,
                                               int index)
                                        throws java.io.UnsupportedEncodingException
        Gets the value of the nth instance of an HTTP response header contained in this Response.

        e.g.

        
         if (response.containsHeader("Set-Cookie")) 
         { 
             // Get the value of the 2nd Set-Cookie header in the response
             String lastModified = response.getHeaderValue("Set-Cookie", 1);
             ... 
         } 
        Parameters:
        header - the HTTP response header to look for
        index - the zero-based index of the response header to look for
        Returns:
        the value of the header, or an empty String if the header does not exist
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        See Also:
        containsHeader(java.lang.String), getHeaderValue(String)
      • getUserAgent

        public java.lang.String getUserAgent()
        Gets the value of the "User-Agent" HTTP response header.
        Returns:
        the value of the "User-Agent" HTTP response header, or an empty String if no such response header exists
        See Also:
        getHeaderValue(String), containsHeader(String)
      • getReferer

        public java.lang.String getReferer()
        Gets the value of the "Referer" HTTP response header.
        Returns:
        the value of the "Referer" HTTP response header, or an empty String if no such response header exists
        See Also:
        getHeaderValue(String), containsHeader(String), hasReferer()
      • hasReferer

        public boolean hasReferer()
        Returns true if this Response contains an HTTP "Referer" response header.
        Returns:
        true if this Response contains an HTTP "Referer" response header
      • getContentType

        public java.lang.String getContentType()
        Gets the value of the "Content-Type" HTTP response header.
        Returns:
        the value of the "Content-Type" HTTP response header, or an empty String if no such response header exists
        See Also:
        getHeaderValue(String), containsHeader(String), getCharSet()
      • getCharSet

        public java.lang.String getCharSet()
        Gets the value of the "charset" parameter specified in the "Content-Type" HTTP response header.

        For example, if the "Content-Type" header is as follows:

        
         Content-Type: text/html; charset=utf-8
         
        then this method would return "utf-8". If no charset is specifed, or if there is no "Content-Type" header, then this method will return an empty String.
        Returns:
        the charset extracted from the "Content-Type" header, or an empty String if none was found
        See Also:
        getContentType(), getCharEncoding()
      • getHeaderKeys

        public java.util.List<java.lang.String> getHeaderKeys()
                                                       throws com.facilita.exception.InternalError
        Gets a list of names of all the HTTP response headers set in this Response.
        Returns:
        a list of names of all the HTTP response headers set in this Response
        Throws:
        com.facilita.exception.InternalError - An internal error occurred
      • getContentEncoding

        public java.lang.String getContentEncoding()
        Gets the value of the "Content-Encoding" HTTP response header.
        Returns:
        the value of the "Content-Encoding" HTTP response header, or an empty String if no such response header exists
        See Also:
        getHeaderValue(String), containsHeader(String)
      • getContentLength

        public long getContentLength()
        Gets the length in bytes of the response content.

        Note that this method returns the actual length of the content, not the value specified by the "Content-Length" HTTP header. In many cases the values will be the same, but not always (e.g. if the content was compressed).

        Returns:
        the length in bytes of the response content
        See Also:
        getContent(), getRawContent(), getBytesDownloaded()
      • getBytesDownloaded

        public long getBytesDownloaded()
        Gets the number of bytes downloaded from the server.

        Note that this method returns the actual number of bytes downloaded from the server. If the content was compressed then this will be less than the length of the content.

        Returns:
        the number of bytes downloaded from the server.
        See Also:
        getContent(), getRawContent(), getContentLength()
      • getSubResponses

        public java.util.List<Response> getSubResponses()
                                                 throws com.facilita.exception.InternalError
        Gets a list of Response objects that describe HTTP responses to sub-requests associated with the top-level Request sent to the web server.

        Once a server responds to a Request, eggPlant Performance will parse the HTML in the response, looking for additional resources that need to be downloaded (such as images, stylesheets or javascript files). These resources will be requested from the server. In addition, sub-requests that have been explicitly added using Request.addSubRequest(Url) will also be requested from the server.

        Returns:
        a List of Response objects corresponding to sub-requests sent to the server, in the order in which the responses were received
        Throws:
        com.facilita.exception.InternalError - An internal error occurred
      • getSendTime

        public int getSendTime()
        Gets the time at which the request was sent to the server (measured in milliseconds since the start of the test).
        Returns:
        the time at which the request was sent to the server, in milliseconds since the start of the test
      • getReceiveTime

        public int getReceiveTime()
        Gets the time at which the response was received from the server (measured in milliseconds since the start of the test).
        Returns:
        the time at which the response was received from the server, in milliseconds since the start of the test
      • getAnchor

        public Url getAnchor​(int n,
                             ActionType failAction)
        Gets the nth anchor in this Response.
        Parameters:
        n - the zero-based index of the anchor to find
        failAction - the action to take in the case that no anchor could be found
        Returns:
        the nth anchor in this Response
      • getContent

        public java.lang.String getContent()
                                    throws java.io.UnsupportedEncodingException
        Gets the content of this Response, using the current encoding (as defined by getCharEncoding()) to decode the data.

        e.g:

        
         // Interpret the content of the Response object as a utf-8 String  
         response.setCharEncoding("utf-8");
         String decodedUtf8Content = response.getContent();
         
        Returns:
        the decoded content of this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        See Also:
        getCharEncoding(), setCharEncoding(java.lang.String), getRawContent()
      • getContentAsXml

        public org.w3c.dom.Document getContentAsXml()
                                             throws java.lang.Exception
        Gets an XML DOM representation of this Response.

        e.g. if the content of the HTTP Response is as follows:

        
         <html>
             <body>
                 <form name="myForm">
                     Select:
                     <select name="mySelect">
                         <option value="1">1</option>
                         <option value="2">2</option>
                     </select>
                 </form>
             </body>
         </html>
         
        The values of the <option> elements can be retrieved from the XML content of the Response by using XPath to search in the myForm form and mySelect select element in the HTML.

        e.g.

        
         import javax.xml.xpath.XPath;
         import javax.xml.xpath.XPathConstants;
         import javax.xml.xpath.XPathExpression;
         import javax.xml.xpath.XPathFactory;
        
         import org.w3c.dom.Document;
         import org.w3c.dom.NodeList;
        
         ...
        
         // Represent the response as an XML document
         Document document = response.getContentAsXml();
                                    
         // Create an XPath expression to find the option nodes in the 'mySelect' select box in the 'myForm' form 
         XPathFactory xPathFactory = XPathFactory.newInstance();
         XPath xPath = xPathFactory.newXPath();
         XPathExpression findOptionsExpression = xPath.compile("//form[@name='myForm']/select[@name='mySelect']/option");
        
         // Evaluate the XPath expression to find all the nodes we are interested in
         NodeList optionNodes = (NodeList)findOptionsExpression.evaluate(document, XPathConstants.NODESET);
        
         // Loop through the matching nodes and print the values
         for (int i = 0; i < optionNodes.getLength(); i++)
         {
             writeMessage(optionNodes.item(i).getAttributes().getNamedItem("value").getTextContent());
         }
         
        Returns:
        an XML DOM representation of this Response
        Throws:
        java.lang.Exception - unable to represent this Response as an XML document, possibly because it is not valid XML
        See Also:
        getContent(), getRawContent(), getContentAsJson()
      • getContentAsJson

        public org.json.simple.JSONObject getContentAsJson()
                                                    throws java.lang.Exception
        Gets an org.json.simple JSON object representation of this Response.

        The following example demonstrates iterating through the elements of the JSON content of a Response.

        
         import org.json.simple.JSONObject;
         ...
         Response response = request.send();
         JSONObject jsonObject = response.getContentAsJson();
         for (Iterator<String> iterator = jsonObject.keySet().iterator(); iterator.hasNext();)
         {
             String key = (String) iterator.next();
             writeMessage(String.format("Key: %s, value: %s", key, jsonObject.get(key)));
         }
         
        Returns:
        An org.json.simple JSON object representation of this Response.
        Throws:
        java.lang.Exception - Unable to convert response into a JSON object
        See Also:
        getContent(), getRawContent(), getContentAsXml()
      • getTitle

        public java.lang.String getTitle()
                                  throws java.io.UnsupportedEncodingException
        Gets the HTML title of this Response. An HTML title is defined as the text between the HTML <title> tags.

        e.g. in the HTML <title>My Page Title</title> the title is My Page Title

        If the response does not contain HTML, or does not contain an HTML title, then this method returns an empty String. The HTML is interpreted using the current character encoding (as defined by getCharEncoding()).

        Returns:
        the HTML title of the response, or an empty String if no title was found
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        See Also:
        hasTitle(), verifyTitle(String), getCharEncoding()
      • hasTitle

        public boolean hasTitle()
        Returns true if this Response contains an HTML title. An HTML title is defined as the text between the HTML <title> tags.

        e.g. in the HTML <title>My Page Title</title> the title is My Page Title

        Returns:
        true if this Response contains an HTML title
        See Also:
        getTitle(), verifyTitle(String)
      • extractForm

        public Form extractForm​(java.lang.String formName)
        Extracts an HTML Form with the specified formName from the response content. The usual reason for extracting a form is because some of the data on the form is needed in a subsequent request.

        e.g.

        
         Response response1 = request1.send();
         // Find the loginForm in the response, and store it in a variable
         Form loginForm = response1.extractForm("loginForm");
         
         ...
         
         // Create a POST request that will send the modified loginForm back to the server
         Request request2 = getWebBrowser().createRequest(HttpMethod.POST, url2, 2);
        
         // Fill in the form by specifying a username/password 
         loginForm.getInputElement("username").setValue("Bob Jones");
         loginForm.getInputElement("password").setValue("Pa55word");
        
         // Attach the form to the request and send it to the server
         request2.setMessageBody(loginForm);
         Response response2 = request2.send();
         
        Parameters:
        formName - the name of the Form to look for in the response
        Returns:
        a Form with the specified formName
      • extractForm

        public Form extractForm​(java.lang.String formName,
                                ActionType failAction)
                         throws java.lang.Exception
        Extracts an HTML Form with the specified formName from the response content, and takes the specified failAction if no matching form can be found. The usual reason for extracting a form is because some of the data on the form is needed in a subsequent request.

        e.g.

        
         Response response1 = request1.send();
         // Find the loginForm in the response, and store it in a variable
         Form loginForm = response1.extractForm("loginForm", ActionType.ACT_WARNING);
         
         ...
         
         // Create a POST request that will send the modified loginForm back to the server
         Request request2 = getWebBrowser().createRequest(HttpMethod.POST, url2, 2);
        
         // Fill in the form by specifying a username/password 
         loginForm.getInputElement("username").setValue("Bob Jones");
         loginForm.getInputElement("password").setValue("Pa55word");
        
         // Attach the form to the request and send it to the server
         request2.setMessageBody(loginForm);
         Response response2 = request2.send();
         
        Parameters:
        formName - the name of the Form to look for in the response
        failAction - the action to take if no matching form can be found
        Returns:
        a Form with the specified formName
        Throws:
        java.lang.Exception - An error occurred during the extraction.
      • extractForm

        public Form extractForm​(int formIndex)
        Extracts the nth HTML Form from the response content. The usual reason for extracting a form is because some of the data on the form is needed in a subsequent request.

        e.g.

        
         Response response1 = request1.send();
         // Find the first form in the response, and store it in a variable
         Form loginForm = response1.extractForm(0);
         
         ...
         
         // Create a POST request that will send the modified loginForm back to the server
         Request request2 = getWebBrowser().createRequest(HttpMethod.POST, url2, 2);
        
         // Fill in the form by specifying a username/password 
         loginForm.getInputElement("username").setValue("Bob Jones");
         loginForm.getInputElement("password").setValue("Pa55word");
        
         // Attach the form to the request and send it to the server
         request2.setMessageBody(loginForm);
         Response response2 = request2.send();
         
        Parameters:
        formIndex - the zero-based index of the Form to look for in the response
        Returns:
        the nth Form in the response
      • extractForm

        public Form extractForm​(int formIndex,
                                ActionType failAction)
                         throws java.lang.Exception
        Extracts the nth HTML Form from the response content, and takes the specified failAction if no matching form can be found. The usual reason for extracting a form is because some of the data on the form is needed in a subsequent request.

        e.g.

        
         Response response1 = request1.send();
         // Find the first form in the response, and store it in a variable
         Form loginForm = response1.extractForm(0, ActionType.ACT_WARNING);
         
         ...
         
         // Create a POST request that will send the modified loginForm back to the server
         Request request2 = getWebBrowser().createRequest(HttpMethod.POST, url2, 2);
        
         // Fill in the form by specifying a username/password 
         loginForm.getInputElement("username").setValue("Bob Jones");
         loginForm.getInputElement("password").setValue("Pa55word");
        
         // Attach the form to the request and send it to the server
         request2.setMessageBody(loginForm);
         Response response2 = request2.send();
         
        Parameters:
        formIndex - the zero-based index of the Form to look for in the response
        failAction - the action to take if no matching form can be found
        Returns:
        the nth Form in the response
        Throws:
        java.lang.Exception - An error occurred during the extraction.
      • extractForms

        public java.util.List<Form> extractForms()
                                          throws com.facilita.exception.InternalError
        Extracts all the HTML Form objects from the response content. The usual reason for extracting a form is because some of the data on the form is needed in a subsequent request.

        e.g.

        
         Response response1 = request1.send();
         // Find a form in the response, and store it in a variable
         List<Form> forms = response1.extractForms();
        
         // This is a dynamic page, sometimes the login form is the second on the page
         Form loginForm = null;
         if (forms.size() == 2)
         {
             loginForm = forms.get(1);
         }
         else
         {
             loginForm = forms.get(0);
         }
         
         ...
         
         // Create a POST request that will send the modified loginForm back to the server
         Request request2 = getWebBrowser().createRequest(HttpMethod.POST, url2, 2);
        
         // Fill in the form by specifying a username/password 
         loginForm.getInputElement("username").setValue("Bob Jones");
         loginForm.getInputElement("password").setValue("Pa55word");
        
         // Attach the form to the request and send it to the server
         request2.setMessageBody(loginForm);
         Response response2 = request2.send();
         
        Returns:
        all the HTML Form objects in the response
        Throws:
        com.facilita.exception.InternalError - An internal error occurred
      • verifyTitle

        public boolean verifyTitle​(java.lang.String title)
                            throws java.io.UnsupportedEncodingException
        Verifies that the title of this Response page matches the specified title.

        The title of a Response object is extracted from between the <title></title> tags in the HTML page content. This method is a simple way to check that a Response object returned from Request.send() or Request.sendTopLevel() methods contains the page that you are expecting it to. If the method returns false, likely causes may include a dropped network connection or an error page returned by the server.

        e.g.

        
         Response response = request.send(); 
         if (!response.verifyTitle("Login successful")) 
         {
             // Login failed - we didn't get the page title we expected 
             nextIteration(); 
         }
         
        When a script is generated from a trace, calls to verifyTitle() are inserted after every Request.send() method call and the page titles from the recorded responses are automatically inserted as parameters.
        Parameters:
        title - the title that this Response object is expected to contain
        Returns:
        true if the title of this Response object matches the specified title
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        See Also:
        getTitle(), hasTitle()
      • verifyTitle

        public boolean verifyTitle​(java.lang.String title,
                                   ActionType action)
                            throws java.lang.Exception,
                                   java.io.UnsupportedEncodingException
        Verifies that the title of this Response page matches the specified title, and takes the specified action if it does not.

        The title of a Response object is extracted from between the <title></title> tags in the HTML page content. This method is a simple way to check that a Response object returned from Request.send() or Request.sendTopLevel() methods contains the page that you are expecting it to. If the method returns false, likely causes may include a dropped network connection or an error page returned by the server.

        e.g.

        
         Response response = request.send(); 
         // Check the title, and move to the next iteration if we detect that the login was unsuccessful
         response.verifyTitle("Login successful", ActionType.ACT_NEXT_ITERATION);
         
        When a script is generated from a trace, calls to verifyTitle() are inserted after every Request.send() method call and the page titles from the recorded responses are automatically inserted as parameters.
        Parameters:
        title - the title that this Response object is expected to contain
        action - the action to take if the expected title is not found
        Returns:
        true if the title of this Response object matches the specified title
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
        See Also:
        getTitle(), hasTitle()
      • verifyResult

        public boolean verifyResult​(HttpStatus expectedResult)
        Verify that the response code of this Response matches the specified expectedResult.

        When a script is generated from a trace, calls to VerifyResult() are inserted after every Request.send() method call and the result from the recorded responses are automatically inserted as parameters.

        Parameters:
        expectedResult - The HTTP status code that this response is expected to have.
        Returns:
        true if the HTTP status of this Response object matches the expectedResult
      • verifyResult

        public boolean verifyResult​(HttpStatus expectedResult,
                                    ActionType action)
                             throws java.lang.Exception
        Verify that the response code of this Response matches the specified expectedResult, and takes the specified action if it does not.

        When a script is generated from a trace, calls to VerifyResult() are inserted after every Request.send() method call and the result from the recorded responses are automatically inserted as parameters.

        Parameters:
        expectedResult - The HTTP status code that this response is expected to have.
        action - the action to take if the HTTP status code does not match the expectedResult
        Returns:
        true if the HTTP status of this Response object matches the expectedResult
        Throws:
        java.lang.Exception - Failed to verify the result
      • find

        public boolean find​(ExtractionCursor cursor,
                            java.lang.String text,
                            boolean caseSensitive)
                     throws java.io.UnsupportedEncodingException
        Finds the specified text within this Response, specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         if (!response.find(cursor, "page loaded successfully", false))
         {
             warn("Page did not load successfully: " + cursor.getErrorMessage());
             nextIteration();
         }
         
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        caseSensitive - true if the search should be case-sensitive
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • find

        public boolean find​(ExtractionCursor cursor,
                            java.lang.String text)
                     throws java.io.UnsupportedEncodingException
        Finds the specified text within this Response. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         if (!response.find(cursor, "page loaded successfully"))
         {
             warn("Page did not load successfully: " + cursor.getErrorMessage());
             nextIteration();
         }
         
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • rfind

        public boolean rfind​(ExtractionCursor cursor,
                             java.lang.String text,
                             boolean caseSensitive)
                      throws java.io.UnsupportedEncodingException
        Finds the specified text within this Response, starting from the end of the content, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         if (!response.rfind(cursor, "page loaded successfully", false))
         {
             warn("Page did not load successfully: " + cursor.getErrorMessage());
             nextIteration();
         }
         
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        caseSensitive - true if the search should be case-sensitive
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • rfind

        public boolean rfind​(ExtractionCursor cursor,
                             java.lang.String text)
                      throws java.io.UnsupportedEncodingException
        Finds the specified text within this Response, starting from the end of the content. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         if (!response.rfind(cursor, "page loaded successfully"))
         {
             warn("Page did not load successfully: " + cursor.getErrorMessage());
             nextIteration();
         }
         
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        java.lang.String defaultValue,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     cursor,
                     "value=\"",
                     "\"",
                     "Joe Jones",
                     true);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        java.lang.String defaultValue)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     cursor,
                     "value=\"",
                     "\"",
                     "Joe Jones");
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        java.lang.String defaultValue,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the f_custid value from the HTML text, defaulting to "00000" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     cursor,
                     before,
                     "\"",
                     "00000",
                     true);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        java.lang.String defaultValue)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the f_custid value from the HTML text, defaulting to "00000" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     cursor,
                     before,
                     "\"",
                     "00000");
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     cursor,
                     before,
                     "\"",
                     true);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.util.List<java.lang.String> before,
                                        java.lang.String after)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     cursor,
                     before,
                     "\"");
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     cursor,
                     "value=\"",
                     "\"",
                     true);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     cursor,
                     "value=\"",
                     "\"");
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.lang.String before,
                                        java.lang.String after,
                                        java.lang.String defaultValue,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive.

        e.g.

        
         Response response = request.send();
         
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     "value=\"",
                     "\"",
                     "Joe Jones",
                     true);
        
         
        Parameters:
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.lang.String before,
                                        java.lang.String after,
                                        java.lang.String defaultValue)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning the defaultValue if they cannot be found.

        e.g.

        
         Response response = request.send();
         
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     "value=\"",
                     "\"",
                     "Joe Jones");
        
         
        Parameters:
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        java.lang.String defaultValue,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found, and specifying whether the search will be case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         
         // extract the f_custid value from the HTML text, defaulting to "00000" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     before,
                     "\"",
                     "00000",
                     true);
        
         
        Parameters:
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        java.lang.String defaultValue)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning the defaultValue if they cannot be found. The search is case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         
         // extract the f_custid value from the HTML text, defaulting to "00000" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     before,
                     "\"",
                     "00000");
        
         
        Parameters:
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        defaultValue - the value to return if either the before or after text cannot be found
        Returns:
        the extracted text, or defaultValue if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     before,
                     "\"",
                     true);
        
         
        Parameters:
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.util.List<java.lang.String> before,
                                        java.lang.String after)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found. The search is case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     before,
                     "\"");
        
         
        Parameters:
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.lang.String before,
                                        java.lang.String after,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive.

        e.g.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     "value=\"",
                     "\"",
                     true);
        
         
        Parameters:
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.lang.String before,
                                        java.lang.String after)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     "value=\"",
                     "\"");
        
         
        Parameters:
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.lang.String before,
                                        java.lang.String after,
                                        ActionType failAction,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and specifying what action to take in case of failure.

        e.g.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     "value=\"",
                     "\"",
                     ActionType.ACT_WARNING,
                     true);
        
         
        Parameters:
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.lang.String before,
                                        java.lang.String after,
                                        ActionType failAction)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying what action to take in case of failure. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     "value=\"",
                     "\"",
                     ActionType.ACT_WARNING);
        
         
        Parameters:
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        ActionType failAction,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and what action to take in case of failure.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     before,
                     "\"",
                     ActionType.ACT_WARNING,
                     true);
        
         
        Parameters:
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        ActionType failAction)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and what action to take in case of failure.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     before,
                     "\"",
                     ActionType.ACT_WARNING,
                     true);
        
         
        Parameters:
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned. If either value cannot be found, the defaultValue will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  "Joe Jones",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned. If either value cannot be found, the defaultValue will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  "Joe Jones",
                                  true);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               java.lang.String defaultValue)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned. If either value cannot be found, the defaultValue will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text, defaulting to "Joe Jones" if the value cannot be found
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  "Joe Jones");
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  true);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"");
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  ActionType.ACT_WARNING,
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  ActionType.ACT_WARNING,
                                  true);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.lang.String after,
                                               java.lang.String before,
                                               ActionType failAction)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  "\"",
                                  "value=\"",
                                  ActionType.ACT_WARNING);
          
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",
                                  "volvo",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",
                                  "volvo",
                                  true);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               java.lang.String defaultValue)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",
                                  "volvo");
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",
                                  true);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"");
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",,
                                  ActionType.ACT_WARNING
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",,
                                  ActionType.ACT_WARNING
                                  true);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(ExtractionCursor cursor,
                                               java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               ActionType failAction)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  cursor,
                                  after,
                                  "value=\"",
                                  ActionType.ACT_WARNING);
         
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned. If either value cannot be found, the defaultValue will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  "Joe Jones",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned. If either value cannot be found, the defaultValue will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  "Joe Jones",
                                  true);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               java.lang.String defaultValue)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned. If either value cannot be found, the defaultValue will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  "Joe Jones");
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  true);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"");
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  ActionType.ACT_WARNING,
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  ActionType.ACT_WARNING,
                                  true);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.lang.String after,
                                               java.lang.String before,
                                               ActionType failAction)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content, starting from the end. Everything between (but not including) the specified after and before string objects will be returned.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extractFromEnd(
                                  "\"",
                                  "value=\"",
                                  ActionType.ACT_WARNING);
          
         
        Parameters:
        after - This text is searched for in the response content, and the returned string starts immediately before this text occurs in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  "volvo",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               java.lang.String defaultValue,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  "volvo",
                                  true);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               java.lang.String defaultValue)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  "volvo");
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        defaultValue - The value to return if either the before or after text cannot be found.
        Returns:
        The extracted text, or defaultValue if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               boolean caseSensitive)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  true);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before)
                                        throws java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"");
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive,
                                               SearchFlags matchFlags)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  ActionType.ACT_WARNING,
                                  true,
                                  SearchFlags.SEARCH_IN_BOTH);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               ActionType failAction,
                                               boolean caseSensitive)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  ActionType.ACT_WARNING,
                                  true);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive.
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractFromEnd

        public java.lang.String extractFromEnd​(java.util.List<java.lang.String> after,
                                               java.lang.String before,
                                               ActionType failAction)
                                        throws java.lang.Exception,
                                               java.io.UnsupportedEncodingException
        Extracts text from the response content starting from the end. Everything between (but not including) the specified list of after and before string objects will be returned.

        Supplying a List<String> of after values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first string in the list, and searches for the second string after the position at which the first string was found. This continues until the final string is matched, after which the extracted response content is returned until before is matched.

        The following example demonstrates extracting text from a HTML Response.

        
         Response response = request.send();
         
         // extract the selected value from the HTML text
         // <select>
         //    <option value="volvo">Volvo</option>
         //    <option value="saab">Saab</option>
         //    <option value="vw">VW</option>
         //    <option value="audi" selected>Audi</option>
         // </select>
         
         List<String> after = new ArrayList<String>();
         after.add("</select>");
         after.add("selected");
         after.add("\"");
         
         String extractedText = response.extractFromEnd(
                                  after,
                                  "value=\"",
                                  ActionType.ACT_WARNING);
         
         
        Parameters:
        after - Each string in this List is searched for sequentially in the response content, and the returned string starts immediately before all the string objects have been matched in the content.
        before - This text is searched for in the response content after the after text has been found, and the returned string ends immediately after this text occurs in the content.
        failAction - the action to take if text cannot be found
        Returns:
        The extracted text, or an empty string if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extractList

        public java.util.List<java.lang.String> extractList​(java.lang.String before,
                                                            java.lang.String after,
                                                            boolean caseSensitive,
                                                            int maxItems)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response, specifying whether the search should be case-sensitive, and the maximum number of items to extract.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the beginning of the web page extract all car model items
         List<String> matchedStrings = response.extractList("<option value=\"", "\">", true, 10);
         // contents of matchedStrings = ( volvo, saab, mercedes, audi )
         
        Parameters:
        before - a String before an item to be extracted
        after - a String after an item to be extracted
        caseSensitive - true if the search should be case-sensitive
        maxItems - the maximum number of items to extract
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractList

        public java.util.List<java.lang.String> extractList​(java.lang.String before,
                                                            java.lang.String after,
                                                            boolean caseSensitive)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response, specifying whether the search should be case-sensitive.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the beginning of the web page extract all car model items
         List<String> matchedStrings = response.extractList("<option value=\"", "\">",true);
         // contents of matchedStrings = ( volvo, saab, mercedes, audi )
         
        Parameters:
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        caseSensitive - true if the search should be case-sensitive
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractList

        public java.util.List<java.lang.String> extractList​(java.lang.String before,
                                                            java.lang.String after)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the beginning of the web page extract all car model items
         List<String> matchedStrings = response.extractList("<option value=\"", "\">");
         // contents of matchedStrings = ( volvo, saab, mercedes, audi )
         
        Parameters:
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            java.lang.String endAt,
                                                            boolean caseSensitive,
                                                            int maxItems)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the position marked by the Extraction Cursor, extract the first 2 car model items
         ExtractionCursor cursor = new ExtractionCursor(); 
         List<String> matchedStrings = response.extractList(cursor, "<option value=\"", "\">","mercedes", true, 2);
         // contents of matchedStrings = ( volvo, saab )
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        endAt - only return matches that occur before this text in the response
        caseSensitive - true if the search should be case-sensitive
        maxItems - the maximum number of items to extract
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            java.lang.String endAt,
                                                            boolean caseSensitive)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the position marked by the Extraction Cursor, extract the car model items that appear before "mercedes"
         ExtractionCursor cursor = new ExtractionCursor(); 
         List<String> matchedStrings = response.extractList(cursor, "<option value=\"", "\">","mercedes", true);
         // contents of matchedStrings = ( volvo, saab )
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        endAt - only return matches that occur before this text in the response
        caseSensitive - true if the search should be case-sensitive
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            java.lang.String endAt)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the position marked by the Extraction Cursor, extract the car model items that appear before "mercedes"
         ExtractionCursor cursor = new ExtractionCursor(); 
         List<String> matchedStrings = response.extractList(cursor, "<option value=\"", "\">","mercedes");
         // contents of matchedStrings = ( volvo, saab )
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        endAt - only return matches that occur before this text in the response
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after)
                                                     throws java.io.UnsupportedEncodingException,
                                                            com.facilita.exception.InternalError
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        
         // The response contains the following text within its body
         // <select>
         //   <option value="volvo">Volvo</option>
         //   <option value="saab">Saab</option>
         //   <option value="mercedes">Mercedes</option>
         //   <option value="audi">Audi</option>
         // </select>
         
         // Searching from the position marked by the Extraction Cursor, extract all the car model items that appear 
         ExtractionCursor cursor = new ExtractionCursor(); 
         List<String> matchedStrings = response.extractList(cursor, "<option value=\"", "\">");
         // contents of matchedStrings = ( volvo, saab, mercedes, audi )
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        Returns:
        a list containing the extracted String objects
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        com.facilita.exception.InternalError - An internal error occurred
        See Also:
        extract(ExtractionCursor, String, String), extractRegExp(ExtractionCursor, String)
      • extractRegExp

        public RegExpMatchList extractRegExp​(ExtractionCursor cursor,
                                             java.lang.String regExp,
                                             boolean caseSensitive)
        Extracts multiple String objects from the response content, wherever the specified regular expression matches, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // write out the HTML comment lines in the current web page
         RegExpMatchList matches = response.extractRegExp(
                     cursor,
                     "<!--.*?-->",
                     true);
        
         for (int i = 0; i < matches.size(); i++)
         {
             writeMessage(matches.get(i).getMatch());
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        regExp - the regular expression to match
        caseSensitive - true if the search should be case-sensitive
        Returns:
        a RegExpMatchList containing the list of matches
      • extractRegExp

        public RegExpMatchList extractRegExp​(ExtractionCursor cursor,
                                             java.lang.String regExp)
        Extracts multiple String objects from the response content, wherever the specified regular expression matches. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
         
         // write out the HTML comment lines in the current web page
         RegExpMatchList matches = response.extractRegExp(
                     cursor,
                     "<!--.*?-->");
        
         for (int i = 0; i < matches.size(); i++)
         {
             writeMessage(matches.get(i).getMatch());
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        regExp - the regular expression to match
        Returns:
        a RegExpMatchList containing the list of matches
      • extractXPath

        public java.lang.String extractXPath​(java.lang.String xpathExpression,
                                             ActionType failAction)
                                      throws java.lang.Exception,
                                             java.io.UnsupportedEncodingException
        Returns a string object from the HTML or XML response content that matches the given XPath expression.

        This method is only applicable if the response content is either HTML or XML. The method returns the first element or attribute value that matches the XPath expression.

        The following example demonstrates extracting a value from an HTML Response using an XPath expression. The value returned is stored in the required extract variable.

        
         Response response = request.send();
         set("xpathExtractVariable", response.extractXPath("/html/body/h1", ActionType.ACT_WARNING));
         
         // Check if a value was extracted.
         if (getString("xpathExtractVariable").length() > 0)
         {
             writeMessage(String.format("xpathExtractVariable: %s", getString("xpathExtractVariable")));
         }
         else
         {
             writeMessage("XPath extract found no match");
         }
         
        Parameters:
        xpathExpression - The XPath expression to be applied to the response content.
        failAction - The action to take if the extract failed.
        Returns:
        The extracted text, or an empty String if the extract failed.
        Throws:
        java.io.UnsupportedEncodingException - The specified encoding is not supported.
        java.lang.Exception - An error occurred
      • verifyContains

        public boolean verifyContains​(java.lang.String text,
                                      boolean caseSensitive)
                               throws java.io.UnsupportedEncodingException
        Returns true if the content of this Response contains the specified text, specifying whether the search will be case-sensitive.

        e.g.

        
         Response response = request.send();
        
         // Check that the login succeeded.
         if (!response.verifyContains("Login successful", false))
         {
             error("Login failed");
             nextIteration();
         }
         
        Parameters:
        text - the text to look for
        caseSensitive - true if the search should be case-sensitive
        Returns:
        true if the text was found
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • verifyContains

        public boolean verifyContains​(java.lang.String text)
                               throws java.io.UnsupportedEncodingException
        Returns true if the content of this Response contains the specified text. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
        
         // Check that the login succeeded.
         if (!response.verifyContains("Login successful"))
         {
             error("Login failed");
             nextIteration();
         }
         
        Parameters:
        text - the text to look for
        Returns:
        true if the text was found
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • find

        public boolean find​(ExtractionCursor cursor,
                            java.lang.String text,
                            ActionType failAction,
                            boolean caseSensitive)
                     throws java.io.UnsupportedEncodingException
        Finds the specified text within this Response, specifying whether the search will be case-sensitive, and what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // If the text below cannot be found in the the response, then move onto the next iteration
         response.find(cursor, "page loaded successfully", ActionType.ACT_NEXT_ITERATION, false);
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • find

        public boolean find​(ExtractionCursor cursor,
                            java.lang.String text,
                            ActionType failAction)
                     throws java.lang.Exception,
                            java.io.UnsupportedEncodingException
        Finds the specified text within this Response, specifying what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // If the text below cannot be found in the the response, then move onto the next iteration
         response.find(cursor, "page loaded successfully", ActionType.ACT_NEXT_ITERATION);
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        failAction - the action to take if text cannot be found
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • rfind

        public boolean rfind​(ExtractionCursor cursor,
                             java.lang.String text,
                             ActionType failAction,
                             boolean caseSensitive)
                      throws java.io.UnsupportedEncodingException
        Finds the specified text within this Response, starting from the end of the content, specifying whether the search will be case-sensitive, and what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // If the text cannot be found, move onto the next iteration 
         response.rfind(cursor, "page loaded successfully", ActionType.ACT_NEXT_ITERATION, false);
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • rfind

        public boolean rfind​(ExtractionCursor cursor,
                             java.lang.String text,
                             ActionType failAction)
                      throws java.lang.Exception,
                             java.io.UnsupportedEncodingException
        Finds the specified text within this Response, starting from the end of the content, specifying what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g:

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // If the text cannot be found, move onto the next iteration 
         response.rfind(cursor, "page loaded successfully", ActionType.ACT_NEXT_ITERATION);
         writeMessage(String.format("Text found at position %d", cursor.getIndex())); 
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        text - the text to search for
        failAction - the action to take if text cannot be found
        Returns:
        true if the specified text was found in this Response
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        ActionType failAction,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and specifying what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     cursor,
                     "value=\"",
                     "\"",
                     ActionType.ACT_WARNING,
                     true);
        
         writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        ActionType failAction)
                                 throws java.lang.Exception,
                                        java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         String extractedText = response.extract(
                     cursor,
                     "value=\"",
                     "\"",
                     ActionType.ACT_WARNING);
        
         writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        ActionType failAction,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, specifying whether the search will be case-sensitive, and what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     cursor,
                     before,
                     "\"",
                     ActionType.ACT_WARNING,
                     true);
        
         writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.util.List<java.lang.String> before,
                                        java.lang.String after,
                                        ActionType failAction)
                                 throws java.lang.Exception,
                                        java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified list of before and after String objects - returning an empty String if they cannot be found, and specifying what action to take in case of failure. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        Supplying a List<String> of before values enables you to express more complicated extraction patterns. eggPlant Performance searches for the first String in the list, and searches for the second String after the position at which the first String was found. This continues until the final String is matched, after which the extracted response content is returned until after is matched. See the example below, in which a known unique name (f_custid) is used to narrow the search.

        e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the f_custid value from the HTML text
         // <input type="text" name="f_customer" size="32" maxlength="32" value="Joe Smith">
         // <input type="text" name="f_custid" size="10" maxlength="10" value="12345">
         // <input type="text" name="f_account" size="10" maxlength="10" value="9876543">
        
         ArrayList<String> before = new ArrayList<String>();
         before.add("f_custid");
         before.add("value=\"");
        
         String extractedText = response.extract(
                     cursor,
                     before,
                     "\"",
                     ActionType.ACT_WARNING);
        
         writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - each String in this List is searched for sequentially in the response content, and the returned String starts immediately after all the String objects have been matched in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        failAction - the action to take if text cannot be found
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        SearchFlags matchFlags)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched. e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML body text, the response header(s) or both:
         // BODY:      <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\<noscript>You do not have Javascript enabled.</noscript>\clientSrc=195.234.243.132;\
         // HEADER(S): Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;Path=/;Secure\r\n
         String extractedText = response.extract(
                                cursor,
                                "clientSrc=",
                                ";",
                                SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extract

        public java.lang.String extract​(ExtractionCursor cursor,
                                        java.lang.String before,
                                        java.lang.String after,
                                        SearchFlags matchFlags,
                                        boolean caseSensitive)
                                 throws java.io.UnsupportedEncodingException
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched. e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML body text, the response header(s) or both:
         // BODY:      <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\<noscript>You do not have Javascript enabled.</noscript>\clientSrc=195.234.243.132;\
         // HEADER(S): Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;Path=/;Secure\r\n
         String extractedText = response.extract(
                                cursor,
                                "clientSrc=",
                                ";",
                                SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH,
                                true);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        before - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        after - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • extractRegExp

        public java.lang.String extractRegExp​(ExtractionCursor cursor,
                                              java.lang.String beforeRegExp,
                                              java.lang.String afterRegExp,
                                              SearchFlags matchFlags)
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found. Information about the success/failure of this method will be stored in the ExtractionCursor object passed. The search is case-sensitive.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched. e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML body text, the response header(s) or both:
         // BODY:      <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\<noscript>You do not have Javascript enabled.</noscript>\clientSrc=195.234.243.132;\
         // HEADER(S): Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrcHeader=195.234.243.264;Path=/;Secure\r\n
         String extractedText = response.extractRegExp(
                                cursor,
                                "client[Ss][Rr][Cc]=|client[Ss][Rr][Cc][Hh][Ee][Aa][Dd][Ee][Rr]=",
                                ";",
                                SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        beforeRegExp - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        afterRegExp - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        the extracted text, or an empty String if the extract failed
      • extractRegExp

        public java.lang.String extractRegExp​(ExtractionCursor cursor,
                                              java.lang.String beforeRegExp,
                                              java.lang.String afterRegExp,
                                              SearchFlags matchFlags,
                                              boolean caseSensitive)
        Extracts text from the response content - everything between (but not including) the specified before and after String objects - returning an empty String if they cannot be found, and specifying whether the search will be case-sensitive. Information about the success/failure of this method will be stored in the ExtractionCursor object passed.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched. e.g.

        
         Response response = request.send();
         ExtractionCursor cursor = new ExtractionCursor();
        
         // extract the value from the HTML body text, the response header(s) or both:
         // BODY:      <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\<noscript>You do not have Javascript enabled.</noscript>\clientSrc=195.234.243.132;\
         // HEADER(S): Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrcHeader=195.234.243.264;Path=/;Secure\r\n
         String extractedText = response.extractRegExp(
                                cursor,
                                "client[Ss][Rr][Cc]=|client[Ss][Rr][Cc][Hh][Ee][Aa][Dd][Ee][Rr]=",
                                ";",
                                SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH,
                                true);
        
         if (cursor.succeeded())
         {
             writeMessage(String.format("The value %s was found at position %d", extractedText, cursor.getIndex()));
         }
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found
        beforeRegExp - this text is searched for in the response content, and the returned String starts immediately after this text occurs in the content
        afterRegExp - this text is searched for in the response content after the before text has been found, and the returned String ends immediately before this text occurs in the content
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        caseSensitive - true if the search should be case-sensitive
        Returns:
        the extracted text, or an empty String if the extract failed
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            SearchFlags matchFlags)
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched.

        
         // The response contains the following text within its body
         // <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">\
         // <html>\
         // <head>\
         // <meta HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO - CACHE\">\
         // <title>Extract Test</title>\
         // </head>\
         // <body>\
         // <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\
         // <noscript>You do not have Javascript enabled.</noscript>\
         // clientSrc=195.234.243.132;\
         // clientSrc=195.234.243.133;\
         // clientSrc=195.234.243.134;\
         // clientSrc=195.234.243.135;\
         // </body>\
         // </html>
         //
         // The header(s) are:
         // Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;clientSrc=195.234.243.265;clientSrc=195.234.243.266;clientSrc=195.234.243.267;Path=/;Secure\r\n
         // 
         // Searching from the position marked by the Extraction Cursor, extract all the "clientSrc" values. If SearchFlags.SEARCH_IN_BOTH is used, the body is searched first and,
         // if the search fails, the header(s) are searched next using a reset cursor.
         ExtractionCursor cursor = new ExtractionCursor();
         List<String> matchedStrings = response.extractList(
                                       cursor,
                                       "clientSrc=",
                                       ";",
                                       SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH);
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        Returns:
        a list containing the extracted String objects
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            SearchFlags matchFlags,
                                                            java.lang.String endAt)
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched.

        
         // The response contains the following text within its body
         // <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">\
         // <html>\
         // <head>\
         // <meta HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO - CACHE\">\
         // <title>Extract Test</title>\
         // </head>\
         // <body>\
         // <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\
         // <noscript>You do not have Javascript enabled.</noscript>\
         // clientSrc=195.234.243.132;\
         // clientSrc=195.234.243.133;\
         // clientSrc=195.234.243.134;\
         // clientSrc=195.234.243.135;\
         // </body>\
         // </html>
         //
         // The header(s) are:
         // Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;clientSrc=195.234.243.265;clientSrc=195.234.243.266;clientSrc=195.234.243.267;Path=/;Secure\r\n
         //
         // Searching from the position marked by the Extraction Cursor, extract all the "clientSrc" values. If SearchFlags.SEARCH_IN_BOTH is used, the body is searched first and,
         // if the search fails, the header(s) are searched next using a reset cursor.
         ExtractionCursor cursor = new ExtractionCursor();
         List<String> matchedStrings = response.extractList(
                                       cursor,
                                       "clientSrc=",
                                       ";",
                                       SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH,
                                       "134");
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        endAt - only return matches that occur before this text in the response
        Returns:
        a list containing the extracted String objects
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            SearchFlags matchFlags,
                                                            java.lang.String endAt,
                                                            boolean caseSensitive)
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched.

        
         // The response contains the following text within its body
         // <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">\
         // <html>\
         // <head>\
         // <meta HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO - CACHE\">\
         // <title>Extract Test</title>\
         // </head>\
         // <body>\
         // <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\
         // <noscript>You do not have Javascript enabled.</noscript>\
         // clientSrc=195.234.243.132;\
         // clientSrc=195.234.243.133;\
         // clientSrc=195.234.243.134;\
         // clientSrc=195.234.243.135;\
         // </body>\
         // </html>
         //
         // The header(s) are:
         // Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;clientSrc=195.234.243.265;clientSrc=195.234.243.266;clientSrc=195.234.243.267;Path=/;Secure\r\n
         //
         // Searching from the position marked by the Extraction Cursor, extract all the "clientSrc" values. If SearchFlags.SEARCH_IN_BOTH is used, the body is searched first and,
         // if the search fails, the header(s) are searched next using a reset cursor.
         ExtractionCursor cursor = new ExtractionCursor();
         List<String> matchedStrings = response.extractList(
                                       cursor,
                                       "clientSrc=",
                                       ";",
                                       SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH,
                                       "134",
                                       true);
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        endAt - only return matches that occur before this text in the response
        caseSensitive - true if the search should be case-sensitive
        Returns:
        a list containing the extracted String objects
      • extractList

        public java.util.List<java.lang.String> extractList​(ExtractionCursor cursor,
                                                            java.lang.String before,
                                                            java.lang.String after,
                                                            SearchFlags matchFlags,
                                                            java.lang.String endAt,
                                                            boolean caseSensitive,
                                                            int maxItems)
        Extracts a list of items from this Response.

        A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.

        The matchFlags parameter determines if the response html body, response header(s) or both are searched.

        
         // The response contains the following text within its body
         // <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">\
         // <html>\
         // <head>\
         // <meta HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO - CACHE\">\
         // <title>Extract Test</title>\
         // </head>\
         // <body>\
         // <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\
         // <noscript>You do not have Javascript enabled.</noscript>\
         // clientSrc=195.234.243.132;\
         // clientSrc=195.234.243.133;\
         // clientSrc=195.234.243.134;\
         // clientSrc=195.234.243.135;\
         // </body>\
         // </html>
         //
         // The header(s) are:
         // Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;clientSrc=195.234.243.265;clientSrc=195.234.243.266;clientSrc=195.234.243.267;Path=/;Secure\r\n
         //
         // Searching from the position marked by the Extraction Cursor, extract all the "clientSrc" values. If SearchFlags.SEARCH_IN_BOTH is used, the body is searched first and,
         // if the search fails, the header(s) are searched next using a reset cursor.
         ExtractionCursor cursor = new ExtractionCursor();
         List<String> matchedStrings = response.extractList(
                                       cursor,
                                       "clientSrc=",
                                       ";",
                                       SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH,
                                       "134",
                                       true,
                                       2);
         
        Parameters:
        cursor - an ExtractionCursor object to store the success/failure of the action, and the index in the response at which the last match was found
        before - a String occurring immediately before an item to be extracted
        after - a String occurring immediately after an item to be extracted
        matchFlags - an SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH
        endAt - only return matches that occur before this text in the response
        caseSensitive - true if the search should be case-sensitive
        maxItems - the maximum number of items to extract
        Returns:
        a list containing the extracted String objects
      • verifyContains

        public boolean verifyContains​(java.lang.String text,
                                      ActionType failAction,
                                      boolean caseSensitive)
                               throws java.io.UnsupportedEncodingException
        Returns true if the content of this Response contains the specified text, specifying whether the search will be case-sensitive, and what action to take in case of failure.

        e.g.

        
         Response response = request.send();
        
         // Check that the login succeeded, and move onto the next iteration if it did not.
         response.verifyContains("Login successful", ActionType.ACT_NEXT_ITERATION, false);
         
        Parameters:
        text - the text to look for
        failAction - the action to take if text cannot be found
        caseSensitive - true if the search should be case-sensitive
        Returns:
        true if the text was found
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
      • verifyContains

        public boolean verifyContains​(java.lang.String text,
                                      ActionType failAction)
                               throws java.lang.Exception,
                                      java.io.UnsupportedEncodingException
        Returns true if the content of this Response contains the specified text, specifying what action to take in case of failure. The search is case-sensitive.

        e.g.

        
         Response response = request.send();
        
         // Check that the login succeeded, and move onto the next iteration if it did not.
         response.verifyContains("Login successful", ActionType.ACT_NEXT_ITERATION);
         
        Parameters:
        text - the text to look for
        failAction - the action to take if text cannot be found
        Returns:
        true if the text was found
        Throws:
        java.io.UnsupportedEncodingException - The encoding is not supported
        java.lang.Exception
      • setCharEncoding

        public void setCharEncoding​(java.lang.String charEncoding)
        Sets the character encoding that is used to decode the data contained in this Response. Usually, the character encoding will be determined automatically by:
        • looking for a charset in the response headers (e.g. Content-Type: text/html; charset=utf-8)
        • looking for a meta-tag in the HTML (e.g. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        • looking for a Byte Order Mark at the beginning of the response data
        • defaulting to ISO-8859-1 (latin-1) if none of the above could be found

        Therefore, it is not usually necessary to call this method explicitly. However, if some of the information above is incorrect/missing, then you can override the encoding by calling this method.

        e.g.

        
         Response response = request.send(); 
        
         // Use the utf-8 character set to interpret the data in this response
         response.setCharEncoding("utf-8"); 
        
         // The utf-8 character set will be used to decode the HTML and determine what the title is 
         response.verifyTitle("我是中国人", ActionType.ACT_NEXT_ITERATION);
         
        Parameters:
        charEncoding - the character encoding that should be used to decode the data in this Response
        See Also:
        getCharEncoding(), resetCharEncoding()
      • getCharEncoding

        public java.lang.String getCharEncoding()
        Gets the character encoding that is used to decode the data contained in this Response, for example "UTF-8".
        Returns:
        the character encoding
        See Also:
        setCharEncoding(String), resetCharEncoding()
      • getVersion

        public java.lang.String getVersion()
        Get the version of HTTP that was used to send this response
        Returns:
        the version of HTTP that was used to send this response