加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Capybara – 检查链接上是否存在数据属性

发布时间:2020-12-16 23:16:45 所属栏目:百科 来源:网络整理
导读:我的页面上有一个特定属性的链接.使用Rspec Capybara如何检查此链接的存在? a href =“#”id =“text”data-content =“这是一个离散的条形图.” Foo / a 不起作用: page.find(:css,'a[data-content="This is a discrete bar chart."]') 作品: page.find(
我的页面上有一个特定属性的链接.使用Rspec Capybara如何检查此链接的存在?

< a href =“#”id =“text”data-content =“这是一个离散的条形图.”> Foo< / a>

不起作用:

page.find(:css,'a[data-content="This is a discrete bar chart."]')

作品:

page.find(:css,'a#test')

解决方法

我有相同的查询,但引号不同.
find("a[data-method='delete']").click

并为我工作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读