How to test for input title/tooltip with rspec

社会主义新天地 提交于 2019-12-23 20:01:27

问题


How do you test for an input's title/tooltip with rspec?

I wasn't testing for tooltips until I noticed a few stopped working and it wasn't caught by the other tests. (Had to add something so the question would be accepted)


回答1:


How about:

find('#element-locator')['title'].should == 'Expected title'



回答2:


You can also look at the HTML attributes:

expect(page).to have_selector("<selector>[data-content='<content>']")



来源:https://stackoverflow.com/questions/16698902/how-to-test-for-input-title-tooltip-with-rspec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!