-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
E.g. this spec fails
anElement().withText("Some text with 'ABC' quoted with single quotes")with this error:
InvalidSelectorError: Unable to locate an element with the xpath expression //*[text() = 'Some text with 'ABC' quoted with single quotes'] because of the following error:
SyntaxError: The expression is not a legal expression.
On inspection of com.lmax.elementspec.XPathElementSpecification#withText :
appendCondition("text() = '" + text + "'")The code could detect single/double quotes and use the 'other' quote to quote the string for the test.
The XPath Recommendation (http://www.w3.org/TR/xpath) states:
Literal ::= '"' [^"]* '"'
| "'" [^']* "'"
So it is impossible to test a single string that contains both types of quotes without complex construction of the test string by concat-ing litertals; e.g.:
*[@text = concat('"', "'")]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels