robotframework / OldSeleniumLibrary

Deprecated Selenium library for Robot Framework
Apache License 2.0
13 stars 3 forks source link

Table keywords should accept table locator as XPath too #158

Closed spooning closed 9 years ago

spooning commented 9 years ago

Originally submitted to Google Code by palani.selvam on 2 Dec 2010

Hi,

Few of my tables do not have id or CSS info to identify them. I can locate them only by xpath.

I modified the code in table.py like below and worked fine. def _get_locator(self, table_locator): if table_locator.startswith("css="): return table_locator else: if table_locator.startswith("xpath="): return table_locator else: return "css=table#%s" % (table_locator)

Can you please include the xpath locator support for table?

Thanks, Palani.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 25 Jan 2011

I took a quick look at the code today. The change is not quite as straightforward as proposed in #1. There are 7 table related keywords, of which only two (Get Table Cell and Table Cell Should Contain) would work with that change.

The other keywords rely on css selectors to get the correct child component, and appending these selectors to xpath would obviously not work. The keywords could probably be made to support also xpath, but the effort required for that is unknown at the moment.

Should we add xpath support first to the two mentioned keywords?

spooning commented 9 years ago

Originally submitted to Google Code by palani.selvam on 25 Jan 2011

Janne, I would prefer to add for all table related keywords. In case, if you feel it require much effort, please add for those 2 keywords..

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 25 Jan 2011

Palani, can you paste a simple example of the problematic HTML with table, so that I can try to test my XPath implementation.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 26 Jan 2011

I was able to refresh my XPath-fu enough to get also the more complicated keywords working with XPath. Need to cleanup the code and make some more tests.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 27 Jan 2011

Now all the Table keywords also accept xpath=... locators.

spooning commented 9 years ago

Originally submitted to Google Code by palani.selvam on 30 Jan 2011

Hi Janne,

Thanks for the implementation and eager to get SeleniumLibrary 2.6

Regards, Palani