当我有多个子标签时,xpath从div中获取text()



我的tag如下:

<div class="popupContent">
  <div class="gwt-HTML">
    <h1 class="v-Notification-caption">Session Expired</h1>
    <p class="v-Notification-description">
      Take note of any unsaved data, and <u>click here</u> or press ESC key to continue.
    </p>
  </div>
</div>

需要使用简单的xpath读取全文。

尝试使用以下:

//*[@class='v-Notification-description'][text()]

我只得到

"请注意任何未保存的数据,并且"

。我如何检索全文。

使用string()函数,以从所选p中的所有text()节点和后代中产生计算的字符串值,在这种情况下为u元素。

string(//*[@class='v-Notification-description'])

最新更新