Hi Sebb/Dave

        We have investigated little more in our code with JMeter and found
the code that is showing problems to us for JMeter to read. A code snippet
written below was returned by JMeter in Result Tree. 

        This code shows the Java Script parameters and values. We want to
extract the "documentId" parameter from this code for the next action to
work, as the next action to this uses "documentId" as Query String. The
"documentId" is marked in Red Font having yellow background.

        Can you suggest any alternatives to read the parameter "documentId"
from this Code using JMeter?

        We tried using Regular Expression [which extracts the HTML Code] to
extract the value but it didn't work out. 

        We have prepared some java script functions also to read this value,
if any way the JMeter uses those functions. 

        We also require more understanding on "BeanShell" to use that
function if it supports reading User Defined Function.

We have already gone ahead with JMeter and relying heavily on this tool. We
need this URGENTLY as our release deadline is approaching and at this point
we just cannot go back. We request you to please help us out ASAP.

Thanks & Regards,
Tapaswini

*************************Code Snippet Begin *******************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script
language="javascript" type="text/JavaScript"
src="/_scripts/adminUtil.js"></script>
<script language="javascript" type="text/JavaScript"
src="/_scripts/commonUtil.js"></script>
<script language="javascript" type="text/JavaScript"
src="/_scripts/userUtil.js"></script>
<table>
        <tr>
                <td>
                        <div id='rightDiv' style="display:inline">
                        </div>
                </td>
        </tr>
</table>
<script language="javascript">
        var resultDiv;
        var messageDiv;
        resultDiv  = document.getElementById("resultDiv");
        messageDiv = document.getElementById("messageDiv");
        if (resultDiv == null) {
                        //alert("Window.opener" + window.opener);
                        if (window.opener != null || typeof window.opener !=
'undefined') {
                                //alert("window.opener");
                        resultDiv =
window.opener.document.getElementById("resultDiv");
                        messageDiv =
window.opener.document.getElementById("messageDiv");
                }
                        else {  
                                //alert("parent.opener" + parent.opener);
                                if (parent.opener != null || typeof
parent.opener != 'undefined') {
                                //alert("parent.opener");
                                resultDiv =
parent.opener.document.getElementById("resultDiv");
                                messageDiv =
parent.opener.document.getElementById("messageDiv");
                                }       
                        }       
        }
        resultDiv.style.display="";
        constructMessageDiv('/img/icon_correct.gif', 'Document created.',
messageDiv);
        var refreshElement;
        var rightDiv;
        if (window.opener != null || typeof window.opener != 'undefined') {

                refreshElement =
window.opener.document.getElementById("refresh_rightDiv");
rightDiv = window.opener.document.getElementById("rightDiv");
        }
        if (refreshElement == null){
                if (parent.opener != null || typeof parent.opener !=
'undefined') {
                        refreshElement =
parent.opener.document.getElementById("refresh_rightDiv");
rightDiv = parent.opener.document.getElementById("rightDiv");

                }       
        }               
        if (refreshElement != null && typeof refreshElement != 'undefined')
{        
        refreshElement.onclick = function(){ 
                                var url  = '<URL of Application>' +
'&action=documentComponents&' + 'documentId=660' +
'&mainview=detail&subview=small';
                                var x = (window.ActiveXObject) ? new
ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
                                if (x!=null) {
                        x.onreadystatechange = function() {
                                if (x.readyState == 4 && x.status == 200) {
                                    rightDiv.innerHTML = x.responseText;
                                }
                        }
                url = url + "&split=" + split + "&paneId=rightDiv&siteArea="
+ getSiteArea();       
                        x.open("GET",url,false);
                        x.send(null);  
                    }
                 }
                refreshElement.click();
                if (window.opener != null || typeof window.opener !=
'undefined')
                        window.close();
                else if (parent.opener != null || typeof parent.opener !=
'undefined')
                        parent.close();
        }       
</script>
*************************Code Snippet End *******************************


-----Original Message-----
From: sebb [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 25, 2006 11:23 PM
To: JMeter Users List
Subject: Re: Where to declare the java script with the help of function and
how to call this function in JMeter

On 25/04/06, Tapaswini Das <[EMAIL PROTECTED]> wrote:
> Hi Dave/Sebb,
>
>  Thank you for your quick reply.
>
>  I have tried the same JMeter script with Regular Expression. The problem
is
> Regular Expression is unable to read inner HTML code used to implement for
> AJAX technology in my application.
>
>  Please find below the full description of the problem faced with
> JMeter2.0.3:

This is rather old. Upgrade to 2.1.1.

> Solution Tried: Regular Expression
> Problem Faced:  JMeter is unable to read inner HTML which is used in AJAX
> implementation. [e.g. for reading auto-generated Folder Id on
the
> HTML] Page
> Outcome:            Regular Expression is unable to read inner HTML.

Why can't you extract the HTML?
What did you try?

> Solution Tried: Static Values for each virtual user using User Defined
> Variables.
> Problems Faced: 1. requires lot of efforts while working with more than 50
> Users.
>                    2. Dynamic features like Upload, Move can not have
> static             values.
> Outcome: It's hectic to use Static values for Load Testing

You can use the Counter test element for generating variable names.

> Solution Tried: Java Script [Used Defined Functions] for dynamic values.
> Problem Faced: JMeter is unable to read the Java Script as per mentioned
by
> you and Sebb.

True - perhaps create a Buzilla enhancement request to add this - e.g.
use a property to create a javascript initialisation file, as is
already done for BeanShell.

> Can you guide me about what can I do for the above problems for using
> JMeter?
> Will it be useful if I use Pearl Script instead of Java Script?

There is no Perl Script in JMeter.

You can use BeanShell; this supports user-defined methods etc.

However, if you are trying to emulate what a browser does when it
encounters JavaScript on a page, it won't help.

You need to find a way to extract the variable information from the
page without having to run the scripts that require access to the page
objects.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to