Ruby help checking to see if a html table has anything it

Hello,

My question is how do I check to see if an html table has anything in
it. I’m learning Ruby and ATDD at the same time and I made a test that
successfully checks to see if there is a specific string, num, float,
etc. in a particular row/column and it works. That being said I was
wondering how to check to see if there’s just anything at all in the
column to return a true statement so I don’t have to reference something
specific.

My code that works:
@browser.table(:index => 0)[7][1].text.include? ‘Hanna’

Is there a way to do something like:

@browser.table(:index => 0)[7][1].text.include? ‘Any string’, Any num,
Any float

I know this doesn’t work but you get the point. Any hope would be
greatly appreciated!

How about

@browser.table(:index => 0)[7][1].text.empty?

Try it for yourself in IRB:

irb(main):001:0> “”.empty?
=> true
irb(main):002:0> not “”.empty?
=> false
irb(main):003:0>

Joel P. wrote in post #1142087:

How about

@browser.table(:index => 0)[7][1].text.empty?

Thank you very much for the reply sir. I want to make sure I understand
it though. It looks like it does the opposite of what I originally
thought. So if the spot is empty it will display an error or return
false? If the space is not empty then it passes the test or is equal to
true? Am I understanding that right?

Thanks again, God bless!

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