我想从标签中获取文本,但不获取嵌套标签中的文本。183591即在下面的示例中,我只想从标签内部获取字符串并从标签中<small>排除文本。这并不简单,因为标签嵌套在标签中。这可以通过 WebDriver 和 XPath 实现吗?Service Request ID:<span><span><small>
标签中的文本每次都会发生变化。
<div id="claimInfoBox" style="background-color: transparent;">
<div class="col-md-3 rhtCol">
<div class="cib h530 cntborder">
<h4 class="no-margin-bottom">
<p>
<small style="background-color: transparent;">
<span class="text-primary" style="background-color: transparent;">Service Request ID:</span>
183591
</small>
</p>
<div class="border-bottom" style="background-color: transparent;"></div>
<div id="CIB_PersonalInfo_DisplayMode" class="cib_block">
<div id="CIB_PersonalInfo_EditMode" class="cib_block" style="display: none">
</div>
</div>
<script type="text/javascript">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)