You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by brock <br...@gmail.com> on 2011/10/26 22:45:48 UTC

Regular Expression Extrator doesnt work on all pages

I am using the Regular Expression Extractor to get the page <TITLE>.  It's
working for 2 page but no for 5 others.


Regex Settings:
Main sample only
Body
<TITLE>(.*)</TITLE>
$1$
1
no_title

"${PageTitle}" == "Verify Login"

For 5 of the pages it always come back no_title, could the structure of the
HTML cause it to not work? I also tried pulling text out of the <body>,
still didn't work on those 5 pages. 

Here is the top part of one of the pages its not working on:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/transitional.dtd&quot;>
<HTML lang="en">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK REL="stylesheet" HREF="/css/web_defaultmenu.css" TYPE="text/css">
<LINK REL="stylesheet" HREF="/css/web_defaulthelp.css" TYPE="text/css">
<TITLE>Outstanding Balance Alert</TITLE>
<META HTTP-EQUIV="Content-Script-Type" NAME="Default_Script_Language"
CONTENT="text/javascript">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">

--
View this message in context: http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4941121.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Regular Expression Extrator doesnt work on all pages

Posted by David Luu <ma...@gmail.com>.
Just wanted to say this is interesting topic. Made me aware of this meta
refresh simulation issue in non-browser tools that I hadn't thought of.

I can see this would also apply to page redirection done with javascript as
well, window.location = newUrl; with something like an HTML body onload
event.

For simplifying JMeter test and more modern approach, the developers should
have utilized HTTP (server based) redirection rather than the meta refresh.
Not sure how to set that up on server side. But for JMeter, you can
configure it to follow those HTTP 302 redirections, which is on by default
for HTTP samplers. Then no need to deal with the messy extraction of meta
tag URLs.

On Thu, Oct 27, 2011 at 11:27 AM, Deepak Shetty <sh...@gmail.com> wrote:

> thats something that your application developers can answer (usually meta
> refresh is legacy code)
>
> regards
> deepak
>
> On Thu, Oct 27, 2011 at 11:18 AM, brock <br...@gmail.com> wrote:
>
> >
> > shettyd wrote:
> > >
> > > Hi
> > > Your response that fails is
> > > "<HTML>
> > > <HEAD>
> > > <meta http-equiv="refresh"
> > > content="0;url=/.../..../
> > >
> >
> twbkwbis.P_GenMenu?name=bmenu.P_MainMnu&amp;msg=WELCOME+Welcome,+User+Name,+to+the+Student+Access+System(ASAP)!Oct+27,+201109%3A20+am">
> > > </HEAD>
> > > </HTML>"
> > >
> > > The meta http-equiv="refresh" is a directive that tells the browser to
> > > refresh the page with the url in the url attribute. However Jmeter (is
> > not
> > > a
> > > browser etc etc) wont do it automatically. Therefore your test fails.
> So
> > > you
> > > have to modify your test to be
> > > Http  Request
> > > +Extract Title (default=notfound)
> > > +Extract meta refresh url (default = notfound)
> > > If("${metaurlrefesh}" != "notfound")
> > > +request metaurlrefresh (but ensure you get the path right , unescape
> > > &amp;)
> > > ++Extract Title again , variable name same as the first Extract Title
> so
> > > that you override the value
> > > if("${title}" == "value1")
> > > +Request 1
> > > if("${title}" == "value2")
> > > +Request 2
> > >
> > > etc etc
> > >
> > > regards
> > > deepak
> > >
> >
> > If I request the meta refresh it just goes to the main landing page where
> > the title is Home, the other page is Fee Reminder.
> >
> > Why do some pages not have the full Response and some do?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943791.html
> > Sent from the JMeter - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>

Re: Regular Expression Extrator doesnt work on all pages

Posted by Deepak Shetty <sh...@gmail.com>.
thats something that your application developers can answer (usually meta
refresh is legacy code)

regards
deepak

On Thu, Oct 27, 2011 at 11:18 AM, brock <br...@gmail.com> wrote:

>
> shettyd wrote:
> >
> > Hi
> > Your response that fails is
> > "<HTML>
> > <HEAD>
> > <meta http-equiv="refresh"
> > content="0;url=/.../..../
> >
> twbkwbis.P_GenMenu?name=bmenu.P_MainMnu&amp;msg=WELCOME+Welcome,+User+Name,+to+the+Student+Access+System(ASAP)!Oct+27,+201109%3A20+am">
> > </HEAD>
> > </HTML>"
> >
> > The meta http-equiv="refresh" is a directive that tells the browser to
> > refresh the page with the url in the url attribute. However Jmeter (is
> not
> > a
> > browser etc etc) wont do it automatically. Therefore your test fails. So
> > you
> > have to modify your test to be
> > Http  Request
> > +Extract Title (default=notfound)
> > +Extract meta refresh url (default = notfound)
> > If("${metaurlrefesh}" != "notfound")
> > +request metaurlrefresh (but ensure you get the path right , unescape
> > &amp;)
> > ++Extract Title again , variable name same as the first Extract Title so
> > that you override the value
> > if("${title}" == "value1")
> > +Request 1
> > if("${title}" == "value2")
> > +Request 2
> >
> > etc etc
> >
> > regards
> > deepak
> >
>
> If I request the meta refresh it just goes to the main landing page where
> the title is Home, the other page is Fee Reminder.
>
> Why do some pages not have the full Response and some do?
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943791.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Regular Expression Extrator doesnt work on all pages

Posted by brock <br...@gmail.com>.
shettyd wrote:
> 
> Hi
> Your response that fails is
> "<HTML>
> <HEAD>
> <meta http-equiv="refresh"
> content="0;url=/.../..../
> twbkwbis.P_GenMenu?name=bmenu.P_MainMnu&amp;msg=WELCOME+Welcome,+User+Name,+to+the+Student+Access+System(ASAP)!Oct+27,+201109%3A20+am">
> </HEAD>
> </HTML>"
> 
> The meta http-equiv="refresh" is a directive that tells the browser to
> refresh the page with the url in the url attribute. However Jmeter (is not
> a
> browser etc etc) wont do it automatically. Therefore your test fails. So
> you
> have to modify your test to be
> Http  Request
> +Extract Title (default=notfound)
> +Extract meta refresh url (default = notfound)
> If("${metaurlrefesh}" != "notfound")
> +request metaurlrefresh (but ensure you get the path right , unescape
> &amp;)
> ++Extract Title again , variable name same as the first Extract Title so
> that you override the value
> if("${title}" == "value1")
> +Request 1
> if("${title}" == "value2")
> +Request 2
> 
> etc etc
> 
> regards
> deepak
> 

If I request the meta refresh it just goes to the main landing page where
the title is Home, the other page is Fee Reminder.

Why do some pages not have the full Response and some do?



--
View this message in context: http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943791.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Regular Expression Extrator doesnt work on all pages

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
Your response that fails is
"<HTML>
<HEAD>
<meta http-equiv="refresh"
content="0;url=/.../..../
twbkwbis.P_GenMenu?name=bmenu.P_MainMnu&amp;msg=WELCOME+Welcome,+User+Name,+to+the+Student+Access+System(ASAP)!Oct+27,+201109%3A20+am">
</HEAD>
</HTML>"

The meta http-equiv="refresh" is a directive that tells the browser to
refresh the page with the url in the url attribute. However Jmeter (is not a
browser etc etc) wont do it automatically. Therefore your test fails. So you
have to modify your test to be
Http  Request
+Extract Title (default=notfound)
+Extract meta refresh url (default = notfound)
If("${metaurlrefesh}" != "notfound")
+request metaurlrefresh (but ensure you get the path right , unescape &amp;)
++Extract Title again , variable name same as the first Extract Title so
that you override the value
if("${title}" == "value1")
+Request 1
if("${title}" == "value2")
+Request 2

etc etc

regards
deepak


On Thu, Oct 27, 2011 at 7:39 AM, brock <br...@gmail.com> wrote:

>
> shettyd wrote:
> >
> > Which doesn't have a title. You have to also extract the meta refresh url
> > and follow that if it exists.
> >  On Oct 27, 2011 7:25 AM, "brock" &lt;brockmoore@&gt; wrote:
> >
>
> Not sure I understand what your asking.  But If I just refresh the browser
> or past in the url it goes to the main landing page.  Which is where it
> should if you clicked the Continue button on the page that doesn't have a
> title in the response.  But if I view the page source it has a <TITLE>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943174.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Regular Expression Extrator doesnt work on all pages

Posted by brock <br...@gmail.com>.
shettyd wrote:
> 
> Which doesn't have a title. You have to also extract the meta refresh url
> and follow that if it exists.
>  On Oct 27, 2011 7:25 AM, "brock" &lt;brockmoore@&gt; wrote:
> 

Not sure I understand what your asking.  But If I just refresh the browser
or past in the url it goes to the main landing page.  Which is where it
should if you clicked the Continue button on the page that doesn't have a
title in the response.  But if I view the page source it has a <TITLE>


--
View this message in context: http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943174.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Regular Expression Extrator doesnt work on all pages

Posted by Deepak Shetty <sh...@gmail.com>.
Which doesn't have a title. You have to also extract the meta refresh url
and follow that if it exists.
 On Oct 27, 2011 7:25 AM, "brock" <br...@gmail.com> wrote:

>
> shettyd wrote:
> >
> > So if you add a response assertion for the HTTP Request (with the same
> > regex)  , then it should fail as well.
> >  Can you then look at the failed HTTP Request : Login and check the exact
> > text in view results tree listener, response tab?
> >
>
> I added it and it did fail.
>
> Here is the text from the response tab: (i dotted out some of the user
> info...)
>
> <HTML>
> <HEAD>
> <meta http-equiv="refresh"
>
> content="0;url=/.../..../twbkwbis.P_GenMenu?name=bmenu.P_MainMnu&amp;msg=WELCOME+Welcome,+User+Name,+to+the+Student+Access+System(ASAP)!Oct+27,+201109%3A20+am">
> </HEAD>
> </HTML>
>
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943133.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Regular Expression Extrator doesnt work on all pages

Posted by brock <br...@gmail.com>.
shettyd wrote:
> 
> So if you add a response assertion for the HTTP Request (with the same
> regex)  , then it should fail as well.
>  Can you then look at the failed HTTP Request : Login and check the exact
> text in view results tree listener, response tab?
> 

I added it and it did fail.

Here is the text from the response tab: (i dotted out some of the user
info...)

<HTML>
<HEAD>
<meta http-equiv="refresh"
content="0;url=/.../..../twbkwbis.P_GenMenu?name=bmenu.P_MainMnu&amp;msg=WELCOME+Welcome,+User+Name,+to+the+Student+Access+System(ASAP)!Oct+27,+201109%3A20+am">
</HEAD>
</HTML>




--
View this message in context: http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4943133.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Regular Expression Extrator doesnt work on all pages

Posted by Deepak Shetty <sh...@gmail.com>.
So if you add a response assertion for the HTTP Request (with the same
regex)  , then it should fail as well.
 Can you then look at the failed HTTP Request : Login and check the exact
text in view results tree listener, response tab?

regards
deepak

On Wed, Oct 26, 2011 at 2:19 PM, brock <br...@gmail.com> wrote:

>
> shettyd wrote:
> >
> > did you create the regex as child of the sampler returning the response?
> >
> > Yes, its looks like this:
> >
> > HTTP Request: Login
> >   RegEx Extractor: Extract Page Title
> >
> > If Controller: Update Password
> >   ...
> > If Controller: Update Contacts
> >   ...
> > If Controller: Update Email
> >   ...
> >
> > The If Controllers are configured as:
> > "${PageTitle}" == "Update Password"
> > "${PageTitle}" == "Update Contacts"
> > "${PageTitle}" == "Update Email"
> >
> > It works for some pages but not all of them.  I did check the page source
> > for the pages not working and they do have quite a few errors and
> warnings
> > reported, I used   http://validator.w3.org/   to check it.
> >
> >> --
> >> View this message in context:
> >>
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4941121.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@.apache
> >> For additional commands, e-mail: jmeter-user-help@.apache
> >>
> >>
> >
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4941215.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Regular Expression Extrator doesnt work on all pages

Posted by brock <br...@gmail.com>.
shettyd wrote:
> 
> did you create the regex as child of the sampler returning the response?
> 
> Yes, its looks like this:
> 
> HTTP Request: Login
>   RegEx Extractor: Extract Page Title
> 
> If Controller: Update Password
>   ...
> If Controller: Update Contacts
>   ...
> If Controller: Update Email
>   ...
> 
> The If Controllers are configured as:
> "${PageTitle}" == "Update Password"
> "${PageTitle}" == "Update Contacts"
> "${PageTitle}" == "Update Email"
> 
> It works for some pages but not all of them.  I did check the page source
> for the pages not working and they do have quite a few errors and warnings
> reported, I used   http://validator.w3.org/   to check it.
> 
>> --
>> View this message in context:
>> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4941121.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@.apache
>> For additional commands, e-mail: jmeter-user-help@.apache
>>
>>
> 


--
View this message in context: http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4941215.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Regular Expression Extrator doesnt work on all pages

Posted by Deepak Shetty <sh...@gmail.com>.
did you create the regex as child of the sampler returning the response?
your regex seems right but a better version is
(?i)<TITLE>([^<]*)</TITLE>

(?i) makes it  case insensitive - A debug sampler added at various locations
+ view results tree helps (you can also run regex on the view results tree)

regards
deepak

On Wed, Oct 26, 2011 at 1:45 PM, brock <br...@gmail.com> wrote:

> I am using the Regular Expression Extractor to get the page <TITLE>.  It's
> working for 2 page but no for 5 others.
>
>
> Regex Settings:
> Main sample only
> Body
> <TITLE>(.*)</TITLE>
> $1$
> 1
> no_title
>
> "${PageTitle}" == "Verify Login"
>
> For 5 of the pages it always come back no_title, could the structure of the
> HTML cause it to not work? I also tried pulling text out of the <body>,
> still didn't work on those 5 pages.
>
> Here is the top part of one of the pages its not working on:
>
> <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
> &quot;http://www.w3.org/TR/html4/transitional.dtd&quot;>
> <HTML lang="en">
> <HEAD>
> <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <LINK REL="stylesheet" HREF="/css/web_defaultmenu.css" TYPE="text/css">
> <LINK REL="stylesheet" HREF="/css/web_defaulthelp.css" TYPE="text/css">
> <TITLE>Outstanding Balance Alert</TITLE>
> <META HTTP-EQUIV="Content-Script-Type" NAME="Default_Script_Language"
> CONTENT="text/javascript">
> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Regular-Expression-Extrator-doesnt-work-on-all-pages-tp4941121p4941121.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>