简体   繁体   English

在这种情况下,如何编写 xpath 来组合工具提示中的文本?

[英]How to write xpath to combine a text from a tooltip in a case like this?

In this element, text is not together in this line:在这个元素中,文本不在这一行中:

<div class="tooltip-inner"> Downtime <br _ngcontent-shw-c48=""> 1.1h </div>

But in console using xpath , I want to combine and print the text in single line like this: " Downtime 1.1h ".但是在使用xpath的控制台中,我想像这样在单行中组合并打印文本:“ Downtime 1.1h ”。

You could use normalize-space with the following XPath:您可以将normalize-space与以下 XPath 结合使用:

In your browser console:在您的浏览器控制台中:

$x("normalize-space(//div[@class='tooltip-inner'])") 

Output: Downtime 1.1h输出: Downtime 1.1h

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM