Is there a way to use xpath to check for an empty string text value in an element? (Cucumber/Capybar

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

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.

glad i could help.

On Tue, Oct 12, 2010 at 9:52 PM, radhames brito [email protected]
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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs