i am new to ruby on rails and cucumber. actually i was trying to compare page title with text i am expecting but dont know that how to get text in ruby. in selenium we can use getText function lik开发者_如何学Goe
assertEquals("ID: 1351018000", selenium.getText("//div[@id='articleInfo']/ul[1]/li[1]"));
can you help in ruby?
in your layout, you can have something like this :
<title> <%= @title %></title>
and everywhere in your application you can specify the title using the @title variable. So you won't need to search for the title. Once you are specifying the title you can compare it with a test string.
i hope it will help you.
response.to_s.match(/<title>(.*?)<\/title>/)[1] will give u title of the page
精彩评论