page-object icon indicating copy to clipboard operation
page-object copied to clipboard

Feature request - Add thead/tbody elements to table

Open janahanEDH opened this issue 11 years ago • 8 comments

Please add thead_element and tbody_element. This is useful for getting just the data rows or the header row from a table.

janahanEDH avatar Nov 28 '14 04:11 janahanEDH

Upvote!

evmorov avatar Dec 08 '14 13:12 evmorov

As long as there isn't a specific behavior needed for these elements, they can be defined like this:

element(:my_header, :theader, :id => 'theader_id')
element(:my_body, :tbody, :id => 'tbody_id')

and as long as you have a good identifier, any element can be identified as

element(:my_element, :element, :id => 'my_element_id')

AlexisKAndersen avatar Apr 22 '15 00:04 AlexisKAndersen

@daneandersen Where is this functionality defined? What exactly are :theader and :tbody in this case?

Edit: Ah never mind, I thought you were referencing the element() method as being any element method, not this one. I understand now.

snowe2010 avatar Apr 23 '15 17:04 snowe2010

no, I was specifically referencing the linked method. It takes a tag of the specific type of element you are looking for. That's what the symbol is. In those three lines of code, the :tbody, :thead, and :element are saying you're looking for a <thead> element, a <tbody> element or any element, respectively.

AlexisKAndersen avatar Apr 23 '15 18:04 AlexisKAndersen

@daneandersen it's not the same. I've seen so many places where these elements so required (table in table or huge tables that are generates dynamically).

evmorov avatar Apr 23 '15 18:04 evmorov

@Evmorov, is there a specific set of behaviors you're looking to get? The element method will get you the element to interact with, but obvious doesn't give you any other behaviors. Are you wanting something that is indexed like a table but just for thead or tbody?

AlexisKAndersen avatar Apr 23 '15 19:04 AlexisKAndersen

@daneandersen I think entire work with tables in PO is a big hole. Performance is horrible, no tr and th elements. I can't formulate now what we want (me and my colleagues). Now we just use Nokogiri in PO. I'll try to formulate problems, show problem examples and write API that I would like to see in PO (I don't think that I'm ready to make so big pull request to PO).

evmorov avatar Apr 23 '15 19:04 evmorov

I appreciate the help. I'm definitely going to check into improving performance, and any help you can give regarding needed API that is missing is very welcome.

AlexisKAndersen avatar Apr 23 '15 19:04 AlexisKAndersen