selenium ide从输入标签中提取文本[value属性]

问题描述 投票:0回答:2

我正在使用selenium IDE编写测试用例,我正在尝试提取下面标记的value属性中的内容

<div id="inputcontainer_f-5" class="FGIC" style="max-width:none;"><input type="text" autocomplete="off" name="f-5" id="f-5" class="dummyclass FastEvtFieldFocus" value="TEXT_I_WANT_TO_GET" readonly="readonly" spellcheck="true" tabindex="-1" style="">
</div>

我的selenium IDE代码

comment    | Target                   | value
store text | xpath=//input[@id='f-3'] | EXTRATCED_CONTENT
echo       | ${EXTRATCED_CONTENT}

结果:我得到空字符串

回声:“”

如果我尝试将xpath更改为xpath=//input[@id='f-3']/@value,我会收到以下错误

storeText on xpath=//input[@id='f-5']/@value with value EXTRATCED_CONTENT Failed:
The result of the xpath expression "//input[@id='f-5']/@value" is: [object Attr]. It should be an element.

如何在变量TEXT_I_WANT_TO_GET中提取和存储EXTRATCED_CONTENT并回显它

谢谢Jk

selenium selenium-ide
2个回答
0
投票

试试这个。

//input[@id='f-3']@value
© www.soinside.com 2019 - 2024. All rights reserved.