Selenium IDE executeScript issue for random strings

48 Views Asked by At

I am new to Selenium IDE.

I have the following script which:

  • Executes successfully if the string variable (i.e. myString) has a value of "a,b,c"
  • Fails to execute if the value is "a,b,'c" (i.e. adding a single quote)

Overall, what I am trying to do is to parse a certain text containing a list of items on the UI. So, the text value is set using command:

Store Text | css = XYZ | myString

and I want to be sure my script would execute successfully regardless of the value of the string on the UI. As you can see, it looks like if the string has some certain characters then the script will fail.

I should also add that when I echo "myString", it would show the string value correctly as "a, b, c". Yet, when it gets to the FOR loop, it throws an error: "bad control character in string literal in json at position X". Some trial-and-error leads to my belief that the error is due to the value of the string (possibly having some special characters).

How do I get around this problem ?

Thanks for your help

enter image description here

0

There are 0 best solutions below