Re: print result.text
Jagadish Anandhan <[email protected]> Sun, 4 Sep 2016 13:03:04 +0530
| Newsgroups | gmane.comp.java.grinder.user |
|---|---|
| Message-ID | <CAKPfy3pc0FtHMnsdC=BHMp8Lip2O5VHiSW27t3b7yBd41YLG6g@mail.gmail.com> |
--===============1695270597647142331== Content-Type: multipart/alternative; boundary=001a114aa8d0fccf22053ba99281 --001a114aa8d0fccf22053ba99281 Content-Type: text/plain; charset=UTF-8 did you try the below statement, should work for you - grinder.getLogger().info(result.text) Regards Jagadish On Thu, Sep 1, 2016 at 10:02 PM, Joan Picanyol i Puig < [email protected]> wrote: > * Alan Jackson <pure_jax-/[email protected]> [20160901 17:11]: > > Hi, > > Can anyone help me write the output of a URL to the out.log file or > another log file > > Currently I have: - > > # tests[2].POST(searchUrl + sessionCookie, result = > tests[14].POST('http://cathp60:7002//search-customer.do' + > sessionCookie, ( NVPair('mpn', '07935139299'), > NVPair('accountId', ''), NVPair('contactType', 'User'), )) > print result.text #WriteToFile(result.text) > > The print result.text will output the result on the command line however > I need to record this result into the log file. > > I tried WriteToFile(result.text) however this just returned an error. > > Can someone please advise? > > Doesn't logging it do what you want? > > from net.grinder.script.Grinder import grinder > grinder.logger.info(result.text) > > http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py > > http://grinder.sourceforge.net/g3/logging.html > > qvb > -- > pica > > ------------------------------------------------------------ > ------------------ > _______________________________________________ > grinder-use mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/grinder-use > -- Regards, *-A J *- Apt No - 508-925-4521 Mobile - 508-981-0870 --001a114aa8d0fccf22053ba99281 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">did you try the below statement, should work for you -=C2= =A0<div><br></div><div>grinder.getLogger().info(result.text)<br></div><div>= <br></div><div>Regards</div><div>Jagadish</div></div><div class=3D"gmail_ex= tra"><br><div class=3D"gmail_quote">On Thu, Sep 1, 2016 at 10:02 PM, Joan P= icanyol i Puig <span dir=3D"ltr"><<a href=3D"mailto:lists-grinder@biaix.= org" target=3D"_blank">[email protected]</a>></span> wrote:<br><bl= ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #= ccc solid;padding-left:1ex">* Alan Jackson <<a href=3D"mailto:pure_jax@y= ahoo.com">pure_jax-/[email protected]</a>> [20160901 17:11]:<br> > Hi,<br> > Can anyone help me write the output of a URL to the out.log file or an= other log file<br> > Currently I have: -<br> > # =C2=A0 =C2=A0 =C2=A0 tests[2].POST(searchUrl + sessionCookie,=C2=A0 = =C2=A0 =C2=A0 =C2=A0 result =3D tests[14].POST('<a href=3D"http://cathp= 60:7002//search-customer.do" rel=3D"noreferrer" target=3D"_blank">http://<w= br>cathp60:7002//search-customer.<wbr>do</a>' + sessionCookie,=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 ( NVPair('mpn', '07935139299'),= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NVPair('accountId', '= '),=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NVPair('contactType= 9;, 'User'), ))=C2=A0 =C2=A0 =C2=A0 =C2=A0 print result.text=C2=A0 = =C2=A0 =C2=A0 =C2=A0 #WriteToFile(result.text)<br> > The print result.text will output the result on the command line howev= er I need to record this result into the log file.<br> > I tried WriteToFile(result.text) however this just returned an error.<= br> > Can someone please advise?<br> <br> Doesn't logging it do what you want?<br> <br> =C2=A0 =C2=A0 from net.grinder.script.Grinder import grinder<br> =C2=A0 =C2=A0 <a href=3D"http://grinder.logger.info" rel=3D"noreferrer" tar= get=3D"_blank">grinder.logger.info</a>(result.<wbr>text)<br> <br> <a href=3D"http://grinder.sourceforge.net/g3/script-gallery.html#helloworld= .py" rel=3D"noreferrer" target=3D"_blank">http://grinder.sourceforge.<wbr>n= et/g3/script-gallery.html#<wbr>helloworld.py</a><br> <br> <a href=3D"http://grinder.sourceforge.net/g3/logging.html" rel=3D"noreferre= r" target=3D"_blank">http://grinder.sourceforge.<wbr>net/g3/logging.html</a= ><br> <br> qvb<br> <span class=3D"HOEnZb"><font color=3D"#888888">--<br> pica<br> <br> ------------------------------<wbr>------------------------------<wbr>-----= -------------<br> ______________________________<wbr>_________________<br> grinder-use mailing list<br> <a href=3D"mailto:[email protected]">[email protected]= ceforge.<wbr>net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/grinder-use" rel=3D= "noreferrer" target=3D"_blank">https://lists.sourceforge.net/<wbr>lists/lis= tinfo/grinder-use</a><br> </font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b= r><div class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><span s= tyle=3D"font-family:trebuchet ms,sans-serif">Regards</span>,<br style=3D"fo= nt-family:trebuchet ms,sans-serif"><i style=3D"font-family:georgia,serif;co= lor:rgb(51,0,0)"><b>-A J </b></i>-<br style=3D"font-family:trebuchet ms,san= s-serif"><span style=3D"font-family:trebuchet ms,sans-serif">Apt No - 508-9= 25-4521</span><br style=3D"font-family:trebuchet ms,sans-serif"><span style= =3D"font-family:trebuchet ms,sans-serif">Mobile - 508-981-0870</span><br></= div> </div> --001a114aa8d0fccf22053ba99281-- --===============1695270597647142331== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============1695270597647142331== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ grinder-use mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/grinder-use --===============1695270597647142331==--