使用javascript解析部分html文本。

问题描述 投票:-1回答:1

78502

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
SUCCESS|78502|25cca4bc-08f9-4a59-85f8-64e0d0700924|
</string>

我感兴趣的是78502,因为它是一个独特的ID,我需要在以后的量角器测试中使用。

这是html的部分。

<span xmlns="http://www.w3.org/1999/xhtml" class="text">SUCCESS|78502|25cca4bc-08f9-4a59-85f8-64e0d0700924|</span>

我现在很困惑,因为我从来没有做过这样的事情,我所做的第一步是得到html元素的xpath,并在上面应用getText方法和console.log-ing它,以检查我至少可以得到值,但这似乎并没有给我元素的值。

javascript parsing protractor
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.