How to add a variable to the waitnuntil method of Karate

51 Views Asked by At
  • def title = 'some real Title'

I want to validate (wait for) title by calling method.

  • waitUntil("document.title == '#(title)'")

But it does not work. Any idea how I need to include title to the wainUntil method?.

1

There are 1 best solutions below

0
Peter Thomas On

The #() placeholder system works only for JSON.

One tip: anywhere in Karate within "round brackets" you can refer to variables directly.

So try this:

* waitUntil("document.title == '" + title + "'")

Read the docs carefully also, pay attention to the part "Karate vs the Browser": https://github.com/karatelabs/karate/tree/master/karate-core#waituntil