Jump to content


Add Post parameters dynamically


  • Please log in to reply
11 replies to this topic

#1 Guest_vince_*

Guest_vince_*
  • Guests

Posted 21 March 2012 - 08:39 AM

Hi All

I'm entirely new to wapt.

I want to add post parameters to a wapt request dynamically based on the response from previous request.

How is it possible?

Thanks in advance

Vince

#2 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 21 March 2012 - 10:52 AM

Hi All

I'm entirely new to wapt.

I want to add post parameters to a wapt request dynamically based on the response from previous request.

How is it possible?

Thanks in advance

Vince


Do you want to add a post parameter with a new name or modify a value of some old one?
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#3 Guest_vince_*

Guest_vince_*
  • Guests

Posted 21 March 2012 - 12:10 PM

Hi Sergei

I want to add a new POST parameter.

#4 Guest_vince_*

Guest_vince_*
  • Guests

Posted 21 March 2012 - 12:32 PM

Hi

I will explain a scenario.
I have a sales order page and it got a grid. According to the user entry the grid may contain any number of items/rows. Say first time it may have 10 items, second time it may have 20 items. So i need to parameterize all the parameters associated with this grid. How can I do that?

Thanks
Vince

#5 Guest_vince_*

Guest_vince_*
  • Guests

Posted 22 March 2012 - 08:46 AM

As an Example consider a Sales Order or and Invoice. The NUmber of Items is most of the times DYNAMIC. It could be 5 Itesm one time and 10, 15, etc... items in other cases. The Name Value pairs handling these will be usually numberred sequentially like:

1. Name = ItemName01, Value = ItemValue01
2. Name = ItemName02, Value = ItemValue02
3. Name = ItemName03, Value = ItemValue03
4. Name = ItemName04, Value = ItemValue04
5. Name = ItemName05, Value = ItemValue05
6. Name = ItemName06, Value = ItemValue06



n. Name = ItemName0n, Value = ItemValue0n

Is tehre any means by which the Name value pairs can be formed dynamically in realtime? Java Sctipt could be one solution, how could we access teh DOM of the previous request?


regards,
Vince

#6 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 22 March 2012 - 10:23 AM

You can create POST request with POST parameters type "Text" and use a variable in request body.
Before POST request you should create JavaScript operator and initialize a value of the variable in JavaScript.
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#7 Guest_vince_*

Guest_vince_*
  • Guests

Posted 22 March 2012 - 01:16 PM

Hi Sergei

I tried with "POST Parameters Type" as "Text" in "POST Parameters" tab without using any javascript, just harcoded POST parameter values. But it is not working!!

#8 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 23 March 2012 - 04:09 AM

Hi Sergei

I tried with "POST Parameters Type" as "Text" in "POST Parameters" tab without using any javascript, just harcoded POST parameter values. But it is not working!!


You need to use JavaScript operator to generate POST parameters.
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#9 Guest_vince_*

Guest_vince_*
  • Guests

Posted 26 March 2012 - 06:07 AM

Hi Sergei

Thanks a lot for your help. Really appreciate it.

Can you please provide a sample example?

Vince

#10 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 26 March 2012 - 10:10 AM

Hi Sergei

Thanks a lot for your help. Really appreciate it.

Can you please provide a sample example?

Vince


See an attached example

Attached Files


Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#11 kingsubbarao1

kingsubbarao1

    Member

  • Members
  • PipPip
  • 11 posts

Posted 12 June 2012 - 09:19 PM

I have a similar scenario where my first page itself is a request that contains numbers that randomly change. I used your example file and i initialized the javascript before page1 and gave a value1. I declared the value1 in initial variables but when i verify it, the script still fails saying value1 is not found. Can you please help? I attached screenshot of my issue if that helps.

Attached Files



#12 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 14 June 2012 - 01:17 PM

If you want to use WAPT variable from JavaScript you should use method:
context.variable("var_name") - gets/sets the value of the "var_name" variable;
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users