我有一个 XPath 查询,它需要匹配 span 属性中的一些文本,如下所示:
my $perl_query = qq(span[text\(\)='It's a problem']);
$sel->click_ok($perl_query);
文本没有撇号的地方没有问题。
我尝试了以下方法而不是“这是个问题”:
'It\'s a problem'
'It&apos\;s a problem'
'It\${apos}s a problem' #some thread on Stackoverflow suggested that this was a solution implemented by Selenium, but it doesn't work.
有任何想法吗?
另一方面,如果我不能解决这个问题,我会很高兴匹配“问题”,但不确定如何在 XPath 中使用 Selenium 进行正则表达式匹配。
感谢您的任何指点