David Kahn
2010-Oct-12 22:08 UTC
Is there a way to use xpath to check for an empty string text value in an element? (Cucumber/Capybara/Selenium)
I have the following Cucumber step where I am trying to verify that the
value of this element is empty, i.e. no characters:
Then I should see "" within the "dominant_occiput"
selector cell
It hits the following custom step where I am using XPath to focus in on the
element, of course this step also should accept text and also match on that
value:
Then /^I should see "([^\"]*)" within the
"([^\"]*)" selector cell$/ do
|text, id|
msg = "No selector_cell found with the content of
''#{text}'' and id of
#{id}"
assert page.find(:xpath,"//*[@id=''#{id}'' and
contains(concat(''
'',normalize-space(@class),'' ''),''
selector_cell '') and text()=''#{(text)}'']",
:visible => true)
end
Is there a way to do this? I see some writing online that XPath does not
recognize ''empty'' situations. Is this true/and/or is there a
better way?
Thanks,
David
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Oct-13 02:52 UTC
Re: Is there a way to use xpath to check for an empty string text value in an element? (Cucumber/Capybara/Selenium)
why arent you using "should not see" with a regular expression for any character? it does take regex. i havent test this but it looks closer than what you are trying to do. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Kahn
2010-Oct-13 14:38 UTC
Re: Is there a way to use xpath to check for an empty string text value in an element? (Cucumber/Capybara/Selenium)
On Tue, Oct 12, 2010 at 9:52 PM, radhames brito <rbritom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > why arent you using "should not see" with a regular expression for any > character? it does take regex. > i havent test this but it looks closer than what you are trying to do. >Oh man, you are right. Originally I had a method only looking for certain text within a certain class - ''selector_cell''. Then when I added the id to the function I forgot about the original web step.> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Oct-13 16:05 UTC
Re: Is there a way to use xpath to check for an empty string text value in an element? (Cucumber/Capybara/Selenium)
glad i could help. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.