0

I'm looking for a solution where I can use the jMeter Regular Expression Extractor for random values, that are NOT empty "".

Regular Expression Extractor

When I add this expression: value="(.*?)" I receive randomly all of them. Sometimes the value is empty as in "". I want to exclude them.

I tried this from a similar question here in the forum, but it doesn't work: $.[.*?(@.value != "")].value

Here is my HTML code

><option data-testid="cyprus-town-select-Agios Athanasios" value="Agios Athanasios">Agios Athanasios</option><option data-testid="cyprus-town-select-Akropolis 35, Dromolaxia" value="Akropolis 35, Dromolaxia">Akropolis 35, Dromolaxia</option><option data-testid="cyprus-town-select-Dhekelia" value="Dhekelia">Dhekelia</option>

These are the results I'm hoping for: Agios Athanasios Akropolis 35, Dromolaxia Dhekelia

Thank you!

1 Answers1

0

Using regular expressions for parsing HTML is not the best idea

I would suggest going for CSS Selector Extractor instead

The relevant CSS selector expression would be something like:

option[value]:not([value=""])

Demo:

enter image description here

More information: How to Use the CSS/JQuery Extractor in JMeter

Dmitri T
  • 159,985
  • 5
  • 83
  • 133