1

I have a string which i am getting

#set($locator=$dataElement.getLocator().get(0))
#set($selector = $locator.getSelector())

$selector is string type and it contains double quotes as well

when i am calling

executor.click(new Params("$selector",BY.$By));

selector have double quotes, which needs to be replaced with single quotes.

i tried with replacing but it is giving error

i referred question

Escaping quotes in velocity template

But this also don't solved my purpose

example

$selector can be something like

 a[@href="somelink"]

and i want that to changed to

a[@href='someLink']
Ravi
  • 719
  • 8
  • 23

1 Answers1

0

For velocity

$selector.replaceAll('"',"'")

replaces " with '

so something like:

executor.click(new Params("$selector.replaceAll('"',"'")",BY.$By)); 

this works fine

Ravi
  • 719
  • 8
  • 23