Canoo WebTest: Get Request URL & Refresh Page

The other day I needed to “re-invoke”/refresh the current page – i.e. the response HTML – during a <webtest />.

Since neither the manual nor a couple of quick Google searches gave me what I needed, here’s how I solved the problem using a simple <scriptStep> followed by an <invoke>:

<scriptStep description="Get the current HTTP Request URL." language="groovy">
def url = step.getContext()
              .getCurrentResponse()
              .getWebResponse()
              .getRequestSettings()
              .getUrl()
              .toExternalForm();
step.setWebtestProperty('tmp.currentRequestUrl', url, step.PROPERTY_TYPE_DYNAMIC);
</scriptStep>
<!-- now you can use it like this or pass it to a definition -->
<invoke url="#{tmp.currentRequestUrl}" />

In case it might be of use to you…

Previous Post

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • @twitter

  • Tags

  • Topics

  • Recent Comments

  • Topic Map Feeds