Forum Discussion

electric_Insura's avatar
electric_Insura
Contributor
14 years ago

Wildcard for request.filter replace?

I'm trying to find all empty nodes and get rid of them with an Events request filter. ("Remove empty content" = true in the request property view is not doing the trick consistently.)

Is there a way to do this with a wildcard so I don't have to list all the nodes that could possibly be empty?

I'm on version 3.6.1.

thanks.

4 Replies

  • Hi!

    hmm.. perhaps.. how are you selecting the nodes currently? What if you use an xpath like

    //ns:*[text()='']

    ?

    /Ole
    smartBear Sweden
  • Ole,

    I'm using a replace filter that looks like this:

    context.requestContent = context.requestContent.replaceAll('<urn:UnderwritingCode/>', '')

    With your suggestion, what would that look like?
  • Hi,

    oh, xpath-statements won't work in replaceAll - what is the issue the RemoveEmpty? If you need recursive removal you can try the following; add this script:

    context.RemoveEmptyRecursive = true

    to the Setup Script of your TestCase...

    does that make any difference?

    regards!

    /Ole
    SmartBear Stockholm
  • Ole,

    That did it - and it has to be in the setup script for the request. Putting it in the Events tab at the project level didn't work.

    thanks!