Selenium 单击命令目标属性在使用 xpath 时不起作用
尝试让 #1 在 Selenium IDE 中工作。 #2 工作正常。我正在尝试检查复选框(输入标签)。当我存储此 xpath id 的值时,它会找到正确的 id。但由于某种原因,click命令无法将xpath表达式的结果解释为id。
HTML:
<输入类型=“复选框”id=“ChkObject813844”>
#1:
命令:单击
目标:xpath=//input[contains(@id,'ChkObject')]/@id <=== 不起作用!
值:
#2:
命令:单击
目标:ChkObject813844 <===正在工作!
值:
Trying to get #1 to work in Selenium IDE. #2 works fine. I'm trying to check the checkbox (input tag). When I store the value of this xpath id, it finds the correct id. But the click command can't interpret the result of the xpath expression as the id for some reason.
HTML:
<input type="checkbox" id="ChkObject813844">
#1:
command: click
target: xpath=//input[contains(@id,'ChkObject')]/@id <=== isn't working!
value:
#2:
command: click
target: ChkObject813844 <=== is working!
value:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
必须在 #1 之前添加一个命令来首先存储 id 的值。
命令:storeValue
目标:xpath=//输入[包含(@id,'ChkObject')]/@id
值:var_id
命令:click
目标:${var_id}
值:
Had to add a command prior to #1 to store the value of the id first.
command: storeValue
target: xpath=//input[contains(@id,'ChkObject')]/@id
value: var_id
command: click
target: ${var_id}
value: