Helping Hands
Helping Hands

Reputation: 5396

How to enter value in text box using Jmeter without post request

I am building Jmeter test plan, in website I have one text both and as soon as I enter any value in textbox, it calculates something and populate one value. Here there is no post/get request. So how can I input some value in such case?

I even recorded everything but did not see that value is posting so somehow I will have to enter value into textbox via jmeter without get/post.

In below screenshot 880 is value which I want to insert via Jmeter.

enter image description here

Html code of text box is :

<input type="number" class="form-control amount_value" id="x_amount" name="amount" placeholder="Number of values" required="required" onkeyup="getprice('SIP','sip-amount',this.value,'4.5556665565')">

Upvotes: 0

Views: 1754

Answers (1)

Dmitri T
Dmitri T

Reputation: 168147

As per JMeter project main page:

JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

So you have 2 options:

  1. There is a WebDriver Sampler plugin for JMeter which provides integration with Selenium so you will be able to kick off a real browser which is capable of executing client-side JavaScript therefore the calculated value would be there
  2. If browser approach is not suitable you need to implement this getprice() JavaScript function using JSR223 PostProcessor with preferably Groovy language

Upvotes: 1

Related Questions