如何获取span按钮的xpath [英] How to get the xpath for the span button

查看:744
本文介绍了如何获取span按钮的xpath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是selenium IDE的新手,并尝试以正确的顺序获取目标。
当有按钮的跨度时,我尝试了很多组合来获得正确的元素。我需要获取阅读更多按钮的xpath。有人请告知IDE中的目标应该如何。
以下是代码:

I am new to selenium IDE and trying to get the target in the right order. I have tried many combination to get the right element when there is span for the button. I need to get the xpath for the "Read More" button.Can someone please advise how the target in the IDE should be. Here is the code:

<div class="is_centered l_bottom_pad">
<a class="btn_teal_outline has_arrow" href="https://test.com/jobs/view.php?id=8">
<span>Read More</span>
</a>
</div>


推荐答案

在某些浏览器中(我认为主要是MSIE)有必要解决< a> 元素,而不是其子< span> 以便点击按钮或链接。所以你应该说:

In some browsers (I think it was mainly MSIE) it is necessary to address the <a> element, not its child <span> in order to click a button or link. So you should adress:

//a[span[text()='Read More']]

或者你直接去LinkText(阅读更多)而不是XPath!

Or you go directly for LinkText ("Read More") instead of XPath!

这篇关于如何获取span按钮的xpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆