Reputation: 15384
I am using Cucumber and Capybara to run some automation tests with chrome and I have an option to run them headless with phantom js
I am trying to get the background-image
url value and can achieve this with
element :errorContainer, "body.error .message-container"
alert = people_form.errorContainer.native.css_value('background-image')
This will return the url, however this fails when running my tests using phantom js as i get
NoMethodError: undefined method `css_value' for #<Capybara::Poltergeist::Node tag="div">
How can i get the background-image url here please
Thanks
Upvotes: 1
Views: 682
Reputation: 762
Try in this way, I hope this will give you an idea:
page.find('div.user-image')['style'].should == 'background-image:url(/images/user_image.jpg)'
Upvotes: 1