robotframework / OldSeleniumLibrary

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

_SELENIUM_LOCATOR_PREFIXES needs to be extensible #68

Closed spooning closed 9 years ago

spooning commented 9 years ago

Originally submitted to Google Code by bryan.oakley on 16 Dec 2009

We need a supported way to extend the list stored in the variable _SELENIUM_LOCATOR_PREFIXES. We use a custom locator implemented as a user extension which has a custom prefix ("lc="). We need to be able to add that to _SELENIUM_LOCATOR_PREFIXES so that it doesn't go through the substitutions done in xpath_for_locator()

I don't have a recommendation for the best way to do this. maybe a keyword like "Add Selenium Locator | lc=", or something to that effect.

The solution we're using now is to create our own library that inherits from SeleniumLibrary, but a more general solution might be useful for others.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 3 Jan 2010

I am hesitant to add keyword to configure library behavior, because they burden the test case maintenance (You have to always ensure that the configuring keyword is used before any dependent keyword). For me it seems that extending the library is exactly the correct way to resolve this issue.

What we could do is to make _SELENIUM_LOCATOR_PREFIXES more easily extensible than it currently is, by adding a private API on top of it.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 9 Feb 2010

Actually, I can think of at least 3 ways in which this could be supported:

1) Keyword Add Selenium Locator 2) Library import parameter 3) A module (say, seleniumlocators), which if found is imported and locators read from an attribute

I think only one should be chosen, I am just not sure which is the best. From design point of view, 3) attracts me, but it is hard to document properly.

Opinions?

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 11 Feb 2010

Actually I should have realized this earlier, but this is actually duplicate to issue 59 , or more specifically, the proposed keywords add_location_strategy does just what is required to resolve this.