0

Trying to create XPath for below string (string is in .properties file and picked up by framework for further identification.):

If you would like to change your answers or finish a section that doesn’t have a checkmark, click on “Change”.

Tried below XPath:

CHANGE_ANSWER = xpath://ul/li[contains(.,concat('If you would like to change your answers or finish a section that doesn',"’", 't have a checkmark',",", ' click on ','“','Change','”','.'))]

Don't know what's exactly wrong.

Sandeep Dhamale
  • 459
  • 2
  • 7
  • 22
  • Does it really need to be a full exact match? Seems like that text would be unique enough that it could be a partial match and still be unique on the page. – JeffC Sep 25 '16 at 20:57
  • There are some more
  • elements with Single quotes, Double quotes and Comma and have similar text. So if I can find XPath for above text I can create same for rest of the texts, though complete match is not required.
  • – Sandeep Dhamale Sep 26 '16 at 05:57
  • Have you tried to escape it using \ before each char that you need to escape? – lauda Sep 26 '16 at 07:31
  • For string-- Once you’ve reviewed this summary and all the information is correct --I tried: A. REVIEW_SUMMARY = xpath://ul/li[contains(.,'Once you\\\'ve reviewed this summary and all the information is correct')] B. REVIEW_SUMMARY = xpath://ul/li[contains(."Once you\'ve reviewed this summary and all the information is correct")] C. REVIEW_SUMMARY = xpath://ul/li[contains(.'Once you’ve reviewed this summary and all the information is correct')] Following works (w/o quotes): REVIEW_SUMMARY = xpath://ul/li[contains(.,'Once')] but i don't want this solution. – Sandeep Dhamale Sep 26 '16 at 08:05
  • Possible duplicate of [how to escape single quote in xslt substring function](http://stackoverflow.com/questions/12403870/how-to-escape-single-quote-in-xslt-substring-function) – Markus Sep 26 '16 at 10:10
  • Nopes...not related to that.. – Sandeep Dhamale Sep 26 '16 at 10:46