Closed spooning closed 9 years ago
Originally submitted to Google Code by mauricek... on 1 Feb 2010
Row and Column count would also be nice. I want to click on a link in a table (result of a previous search action) based on a value in different column in same row. I need keywords to support this.
Originally submitted to Google Code by Andreas.EbbertKarroum on 24 Apr 2010
I believe it should be possible to achieve most with some clever css selectors and nth-of-type pseudo elements (and use "Element should contain" keyword internally).
Table Should Contain some text Table Header Should Contain some text Table Row Should Contain 2 some text Table Column Should Contain 4 some text Table Cell Should Contain 2 4 some text
Row and Column count would be difficult, but I assume you want to know the numbers to assert on them. You could also do that with one of the keywords above:
Table Row Should Contain 14 some text
This would assert that the table has at least 14 rows. It would even be possible to use special "first" or "last" instead of concrete row/column count to assert for first or last row/column.
I'll try this out :)
Originally submitted to Google Code by @pekkaklarck on 25 Apr 2010
The proposed keywords look great! Few issues to decide still:
1) How should Table Cell Should Contain
behave? Should it verify that the given
text exists in the cell or that the text matches the cell contents exactly? In the
latter case it should probably be named Table Cell Content Should Be
. I think
Contains
is better.
2) Should we also implement Get Table Cell
(or Get Table Cell Content
)? It would
be useful because then it's possible to use BuiltIn keywords such as Should Match Regexp
to create user keywords with more complicated checks.
3) Keywords that return more cells (Get Table Cells
, Get Table Row
) would be nice
too but may be complicated to implement. These keywords should return lists that can
be then checked/manipulated with Collection library keywords. If these are hard, they
can be implemented later.
4) Should row/column indexes start from 0 or 1? In this usage I'd prefer 1.
5) Special indexes first
and last
are a good idea. It would probably be a good
idea to support also negative indexes that start from the end. For example -1 would
be the last index, -2 the second last, and so on.
Originally submitted to Google Code by @pekkaklarck on 25 Apr 2010
Issue 104 has been merged into this issue.
Originally submitted to Google Code by Andreas.EbbertKarroum on 25 Apr 2010
1) I agree. -> "Contains" 2/3) When retrieving content, you get into the business of parsing the html document. It can be done (after all, we can get the sources of the page), but I don't know the proper python libs to do that 4) don't know. do we have other indexes in selenium, SeleniumLibrary or RF? do they start normally on 1 or 0? If we can choose, starting from 1 seems reasonable. 5) good idea, should be working with css pseudo-class :nth-last-of-type()
Many of these css selectors are css3 and only supported by newer browsers. I will put in the docs a link to a compatibility chart. Also the table should be identifyable by id or name.
Originally submitted to Google Code by Andreas.EbbertKarroum on 25 Apr 2010
2) just stumbled over a nice selenium function "get_table" :) I still think that we should start indexes from 1 and convert that before calling selenium.
http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/python/selenium.selenium-class.html#get_table
3) leave it for later :)
Originally submitted to Google Code by @pekkaklarck on 25 Apr 2010
Looks good. I agree 3) can be left for later if it's not easy to implement.
Originally submitted to Google Code by Andreas.EbbertKarroum on 25 Apr 2010
initial work in revision 96018b7b28
Originally submitted to Google Code by mauricek... on 25 Apr 2010
Nice work so far! 'Get Table Cell' is something I really need.
NOTE: Any ideas how to handle nested tables?
Originally submitted to Google Code by Andreas.EbbertKarroum on 26 Apr 2010
Thanks :)
How do you want to have nested tables handled? IMHO it's a table like any other table. Means if you say that the outer table should contain any text in a row, column or cell, that contains a nested table, when the nested table contains that text, it matches. Also, a nested table can be identified by id, so you can just make assertions for the nested table on it's own.
Yesterday I ran into the problem, that with css selectors, your cannot match by id OR by name, just one or the other (at least to the best of my knowledge). We could make seperate assertions to and let the keyword only fail, if neither of them matches. or we say, we only check by id, and if the users want's something more sophisticated, he can still build the css selector on his own. Thoughts?
Originally submitted to Google Code by Andreas.EbbertKarroum on 26 Apr 2010
This is the current set of tables, that I intent to use for testing, anything that is missing in your opinion?
http://robotframework-seleniumlibrary.googlecode.com/hg/test/resources/html/tables/tables.html?r=96018b7b28bc021470f7930d5f697fef66312794
Originally submitted to Google Code by Andreas.EbbertKarroum on 26 Apr 2010
Selenium's get_table command only works with IDs, not with name attributes, so I would make the new table keywords work with IDs as well. (If we discover, that we need to match on names optionally, we can hopefully add it later).
Maurice, would that be ok with you?
How do you intent to work with the "Get Table Cell" keyword?
Originally submitted to Google Code by @pekkaklarck on 26 Apr 2010
I think support for IDs is enough at least initially. That's the attribute you should, AFAIK, use in this kind of situations anyway. Is it still possible to support for free xpath expressions?
All this needs to be obviously documented adequately.
Originally submitted to Google Code by Andreas.EbbertKarroum on 26 Apr 2010
xpath probably not, but I could imagine, that we can pass in a css selector which we then extend.
Originally submitted to Google Code by @pekkaklarck on 29 Apr 2010
Andreas committed most of these keywords in revision d52872e30d. Great work!
Originally submitted to Google Code by Andreas.EbbertKarroum on 30 Apr 2010
This issue was updated by revision 814f368abb.
Comment: tables can now be identified with a css locator
Originally submitted to Google Code by Andreas.EbbertKarroum on 30 Apr 2010
This issue was updated by revision d2a9e38611.
Comment: Implemented Pekka's review comments from https://code.google.com/p/robotframework-seleniumlibrary/source/detail?r=d52872e30d
Originally submitted to Google Code by Andreas.EbbertKarroum on 30 Apr 2010
This issue was updated by revision 942083c4b0.
Comment: keyword documentation
Originally submitted to Google Code by Andreas.EbbertKarroum on 30 Apr 2010
Hi,
I added the documentation of the keywords. Could you please take a look at all the table related keywords and let me know, if you miss something?
http://robotframework-seleniumlibrary.googlecode.com/hg/doc/SeleniumLibrary.html
Thanks! Andreas
Originally submitted to Google Code by Andreas.EbbertKarroum on 30 Apr 2010
This issue was updated by revision cc1a942932.
Comment: Ooops, forgot to commit the python keyword docs.
Originally submitted to Google Code by Andreas.EbbertKarroum on 2 May 2010
If there are no further comments, I consider this issue completed :)
Originally submitted to Google Code by @pekkaklarck on 3 May 2010
Docs look good already. See my comments to revision cc1a942932, though.
Originally submitted to Google Code by Andreas.EbbertKarroum on 3 May 2010
This issue was updated by revision 47c1c0d25f.
Comment: incorporated Pekka's comments regarding the documentation. I wonder if we also should have keywords for negative tests (Table Must Not Contain"). They would be useful, but also bloat the library a little bit.
Originally submitted to Google Code by @pekkaklarck on 3 May 2010
Keywords that are useful should obviously be added. If it's not sure are they really needed, they can be added later when the need arises. I'd say the current keywords enough for this release.
From the Zen of Python:
Now is better than never.
Although never is often better than *right* now.
Originally submitted to Google Code by Andreas.EbbertKarroum on 8 May 2010
I agree. Let's go public with this and see if we need more.
Originally submitted to Google Code by @yanne on 27 May 2010
Major improvements warrant a major version
Originally submitted to Google Code by efsungur... on 8 Jun 2012
Hi,
Do you know in near future if 'Table Row Should Not Contain' would work? You got any suggestions how to get the same functionality?
Get Table Cell Value Table Cell Value Should Be Get Table Row Get Table Column
and possibly some others should be implmented