How do I escape an apostrophe in my XPath text query with Perl and Selenium?
It's an XPath problem rather than the Perl problem.
The problem was discussed and answered here in great detail:http://kushalm.com/the-perils-of-xpath-expressions-specifically-escaping-quotes (broken link)
In a nutshell, modify your xquery to assemble the quote-containing string using
my $perl_query = qq(span[text\(\)=concat("It","'","s a problem"]);
A couple of suggestions; hopefully at least one of them will work:
my $perl_query = qq!span[text()='It\\'s a problem']!;my $perl_query = qq!span[text()="It's a problem"]!;
I just had the same problem and google didn't give me a satisfied solution.
I tried to substring this: value=' - ending with an Apostrophe.
My XPath that works look like:
"substring-after(., concat('value=', ''''))"
So four Apostrophes in a row.