If I've got some HTML like:
<div id='drawer'><ul><li><a href='www'>description</a>...
I've seen that I can get the value of href in Capybara with:
page.find('div#drawer a')['href']
But is there any way to retrieve that value if it's completely described as a css string? ie, trying to get the value for 'div#drawer a[href]'
I've tried with expressions like this:
page.find('div#drawer a[href]') => can't convert Capybara::Node::Element into String (TypeError)
page.find('div#drawer a[href]').value => can't convert nil into String (TypeError)
page.find('div#drawer a[href]').text => returns the text value of 'description'
I've got that css expression in an external config file, so would it be possible somehow to just use it directly and retrieve the value of the attribute in question?
Thank you...
Probably too late. But I also had the same problem and found the solution. It might help someone else.
page.find('div#drawer a')[:href]