XPath子弦在Firefox Web检查员/控制台中是否有效?
此XPath返回一个百分比(例如16%):
//div/div/div[@class='underlay']/strong
我只想提取数字“ rel =“ nofollow noreferrer”> substring
,
substring (//div/div/div[@class='underlay']/strong, 1, 2)
但它只是返回错误消息。
这应该是可行的吗?
根据语法上方的链接上的文档是substring(字符串,start,length)
,
。还有其他方法可以获取数字(16)吗?
谢谢。
更新:我在Web Inspector的搜索字段以及使用$ x(“ //*”)中使用了它
This Xpath returns a percentage (e.g, 16%):
//div/div/div[@class='underlay']/strong
I want to extract just the digits so I tried substring
substring (//div/div/div[@class='underlay']/strong, 1, 2)
but it just returns an error message.
Is this supposed to work?
According to the documentation on the link above the syntax is substring(string, start, length)
and it is supported by Gecko.
Are there any other way to just get the digits (16)?
Thank you.
Update: I used it in the web inspector's search field as well as in the console using $x("//*")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚在此页面上打开了Firefox的Inspector面板,并在控制台中评估了以下内容:
结果是字符串“ 16”。因此,我认为我们可以说它绝对可以起作用。
I just opened Firefox's inspector panel on this very page and evaluated the following in the console:
The result was the string "16". So I think we can say that it should definitely work.