So I have setup a Capybara, Cucumber project with SitePrism for POM and for the most part it works. When I use:
Then('Find object name') do
expect(@page).to have_object_name
end
it works just fine but when I come to use:
Then('Assign object names text to a variable') do
expect(@page).to have_object_name
valueA = @page.find('object_name').text
end
this doesnt work and throws an error
Unable to find css "object_name" (Capybara::ElementNotFound)
However, if I use:
Then('Assign object names text to a variable') do
expect(@page).to have_object_name
valueA = @page.find(:xpath, 'object_name_XPath').text
end
this works out just fine as well, but this sort of defeats the point of POM as it would greatly increase maintenance.
I assume I must be missing something to get the page.find locate the object_name from my page but I have danced around it and searched high and low but can't seem to figure the problem out. Help? :)