[Webtest] String manipulations in a Canoo script

Florent Blondeau Florent Blondeau <fblondeau@pingwy.com>
Mon, 22 Sep 2008 17:18:31 +0200


This is a multi-part message in MIME format.
--------------060003020703010807070001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Bonjour Delphine,

As Marc said the first time, a groovy step on your stored regexp could 
help you handle your URL (3D is the hexa code for equals sign in encoded 
url, I think)
<groovy>
          // not sure you need this, don't have a webtest runtime to test
         import java.util.regex.Matcher
               import java.util.regex.Pattern

           def  props = step.webtestProperties
           def  stored_regex = props.get('MyLink')
           def result = (stored_regex =~ /3D/).replaceAll("")
           println result

           props.putAt("MyLink_Delphine", result)
</groovy>

And you can use the property "MyLink_Delphine" in the following steps

Hope that helps

A bientôt

Florent

Pingwy
27, rue des arènes
49100 Angers



Delphine Denis a écrit :
> Hi Marc,
> I promise I am not trying to perform a request that wouldn't exist in a
> "normal" usage... :-)
> Actually, I try to click a link in an email.
> With emailMessageContentFilter I can have the content of the email, but
> chars '3D' are inserted at the begining of each value, and I need to
> remove them before I call the link.
> Or may be you know something about those '3D'?
>
> Last week, I tried to create a script in beanshell, but I am not sure
> about the functions I can use or not...
> I wrote this:
> <property name="myurl"
> value="http://www.mjr1108.com/candidate/candidateLoginMailValidated.mj?messageParameter=-2293237856199301773819138803679945509612940613654002407700"/>
>  <script language="beanshell">
>       print (myurl);
>       getChar(5, myurl);
> </script>
>
> But I have an exception (at the end of this email) when I run it.
> Thank you for your help!
> Delphine
>
> C:\Canoo\MeteojobTestProject\tests\StringManip.xml:9: Unexpected exception caught: org.apache.tools.ant.BuildException
> 	at com.canoo.webtest.steps.StepUtil.handleException(StepUtil.java:120)
> 	at com.canoo.webtest.steps.Step.handleException(Step.java:379)
> 	at com.canoo.webtest.steps.Step.execute(Step.java:110)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.Main.runBuild(Main.java:698)
> 	at org.apache.tools.ant.Main.startAnt(Main.java:199)
> 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> Caused by: C:\Canoo\MeteojobTestProject\tests\StringManip.xml:11: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
>  BSF info: ANT at line: 0 column: columnNo
> 	at org.apache.tools.ant.util.optional.ScriptRunner.throwBuildException(ScriptRunner.java:159)
> 	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:108)
> 	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
> 	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
> 	at com.canoo.webtest.steps.Step.execute(Step.java:101)
> 	... 47 more
> Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
>  BSF info: ANT at line: 0 column: columnNo
> 	at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
> 	at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
> 	at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
> 	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:103)
> 	... 57 more
> --- Nested Exception ---
> C:\Canoo\MeteojobTestProject\tests\StringManip.xml:11: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
>  BSF info: ANT at line: 0 column: columnNo
> 	at org.apache.tools.ant.util.optional.ScriptRunner.throwBuildException(ScriptRunner.java:159)
> 	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:108)
> 	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
> 	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
> 	at com.canoo.webtest.steps.Step.execute(Step.java:101)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.Main.runBuild(Main.java:698)
> 	at org.apache.tools.ant.Main.startAnt(Main.java:199)
> 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
>  BSF info: ANT at line: 0 column: columnNo
> 	at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
> 	at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
> 	at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
> 	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:103)
> 	... 57 more
> --- Nested Exception ---
> org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
>  BSF info: ANT at line: 0 column: columnNo
> 	at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
> 	at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
> 	at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
> 	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:103)
> 	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
> 	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
> 	at com.canoo.webtest.steps.Step.execute(Step.java:101)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.Main.runBuild(Main.java:698)
> 	at org.apache.tools.ant.Main.startAnt(Main.java:199)
> 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>
>   
> Marc Guillemot a écrit :
>   
>> Hi Delphine,
>>
>> just for my curiosity: do you want to perform a request that wouldn't
>> exist in a "normal" usage of your app?
>>
>> With a Groovy (or script) step, you can access the properties and
>> manipulate them as you want.
>>
>> Cheers,
>> Marc.
>>   
>>     
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>   

--------------060003020703010807070001
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Bonjour Delphine,<br>
<br>
As Marc said the first time, a groovy step on your stored regexp could
help you handle your URL (3D is the hexa code for equals sign in
encoded url, I think)<br>
<small>&lt;groovy&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; // not sure you need this, don't have a webtest runtime to
test<br>
</small><span class="code-keyword">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <small>import</small></span><small>
java.util.regex.Matcher<span class="code-keyword"><small><br>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; </small>import</span> java.util.regex.Pattern<br>
<br>
</small><small>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def&nbsp; props = step.webtestProperties<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def&nbsp; stored_regex = props.get('MyLink')<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def result = (<span class="code-quote">stored_regex</span>
=~ /3D/).replaceAll(<span class="code-quote">""</span>)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; println result<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; props.putAt("MyLink_Delphine", result)<br>
&lt;/groovy&gt;</small><br>
<br>
And you can use the property "MyLink_Delphine" in the following steps<br>
<br>
Hope that helps<br>
<br>
A bient&ocirc;t<br>
<br>
Florent<br>
<pre class="moz-signature" cols="72">Pingwy
27, rue des ar&egrave;nes
49100 Angers
</pre>
<br>
<br>
Delphine Denis a &eacute;crit&nbsp;:
<blockquote cite="mid:48D7AA09.8080707@travelsoft.fr" type="cite">
  <pre wrap="">Hi Marc,
I promise I am not trying to perform a request that wouldn't exist in a
"normal" usage... :-)
Actually, I try to click a link in an email.
With emailMessageContentFilter I can have the content of the email, but
chars '3D' are inserted at the begining of each value, and I need to
remove them before I call the link.
Or may be you know something about those '3D'?

Last week, I tried to create a script in beanshell, but I am not sure
about the functions I can use or not...
I wrote this:
&lt;property name="myurl"
value=<a class="moz-txt-link-rfc2396E" href="http://www.mjr1108.com/candidate/candidateLoginMailValidated.mj?messageParameter=-2293237856199301773819138803679945509612940613654002407700">"http://www.mjr1108.com/candidate/candidateLoginMailValidated.mj?messageParameter=-2293237856199301773819138803679945509612940613654002407700"</a>/&gt;
 &lt;script language="beanshell"&gt;
      print (myurl);
      getChar(5, myurl);
&lt;/script&gt;

But I have an exception (at the end of this email) when I run it.
Thank you for your help!
Delphine

C:\Canoo\MeteojobTestProject\tests\StringManip.xml:9: Unexpected exception caught: org.apache.tools.ant.BuildException
	at com.canoo.webtest.steps.StepUtil.handleException(StepUtil.java:120)
	at com.canoo.webtest.steps.Step.handleException(Step.java:379)
	at com.canoo.webtest.steps.Step.execute(Step.java:110)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: C:\Canoo\MeteojobTestProject\tests\StringManip.xml:11: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
 BSF info: ANT at line: 0 column: columnNo
	at org.apache.tools.ant.util.optional.ScriptRunner.throwBuildException(ScriptRunner.java:159)
	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:108)
	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
	at com.canoo.webtest.steps.Step.execute(Step.java:101)
	... 47 more
Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
 BSF info: ANT at line: 0 column: columnNo
	at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
	at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
	at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:103)
	... 57 more
--- Nested Exception ---
C:\Canoo\MeteojobTestProject\tests\StringManip.xml:11: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
 BSF info: ANT at line: 0 column: columnNo
	at org.apache.tools.ant.util.optional.ScriptRunner.throwBuildException(ScriptRunner.java:159)
	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:108)
	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
	at com.canoo.webtest.steps.Step.execute(Step.java:101)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
 BSF info: ANT at line: 0 column: columnNo
	at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
	at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
	at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:103)
	... 57 more
--- Nested Exception ---
org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : Command not found: getChar( int, java.lang.String ) : at Line: 3 : in file: inline evaluation of: ``       print (myurl); 	  getChar(5, myurl); 	  System.out.println("message is "  . . . '' : getChar ( 5 , myurl ) 
 BSF info: ANT at line: 0 column: columnNo
	at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
	at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
	at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:103)
	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
	at com.canoo.webtest.steps.Step.execute(Step.java:101)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)

  
Marc Guillemot a &eacute;crit :
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi Delphine,

just for my curiosity: do you want to perform a request that wouldn't
exist in a "normal" usage of your app?

With a Groovy (or script) step, you can access the properties and
manipulate them as you want.

Cheers,
Marc.
  
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
WebTest mailing list
<a class="moz-txt-link-abbreviated" href="mailto:WebTest@lists.canoo.com">WebTest@lists.canoo.com</a>
<a class="moz-txt-link-freetext" href="http://lists.canoo.com/mailman/listinfo/webtest">http://lists.canoo.com/mailman/listinfo/webtest</a>
  </pre>
</blockquote>
</body>
</html>

--------------060003020703010807070001--