alqoush
alqoush

Reputation: 21

JMeter waitfor page to load fully

is it possible to wait for XPath or CSS selector to display in Jmeter?

I am using HTTP request to send API call and I have assertion as CSS selector path but due to API slowness , I would like to implement a waitfor method for the specific element in UI.

Upvotes: 0

Views: 168

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

JMeter doesn't execute any Post-Processors or Assertions or Listeners until it gets response from the server therefore you don't need to do anything. See Execution order user manual chapter for more details.


However if I misunderstood your requirement and you want to repeat a HTTP request until XPath or CSS extractor return the value you're looking for you can put the request under the While Controller and put the condition of your choice there:

enter image description here

In the above case:

  • On iteration 0 of the While Controller ${myVariable} doesn't have any value (CSS Selector Extractor hasn't been executed yet)
  • Iterations from 1 to 5 - ${myVariable} has value of foo which doesn't match While Controller's condition so it loops over
  • Iteration 6 - ${myVariable} value becomes bar and the While Controller exits the loop.

Just in case, textual representation of the jexl3() function used to compare variable with some value:

${__jexl3("${myVariable}" != "bar",)}

Upvotes: 1

Related Questions