You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New strategy:value syntax to specify locator strategy in addition to current strategy=value #908
Currently when specifying a non-default locator for an element, the syntax is name=value like in xpath=//h1 or css=h1. This works well otherwise, but the same syntax is also used by Robot Framework's named argument syntax and this can cause confusion.
Using the same syntax also causes actual problems if a keyword would accept **kwargs, because then Robot considers all arguments looking like name=value to match it. There's also a possibility that some time in the future Robot will always do that, regardless on the function signature. Robot allows escaping the problematic = like in name\=value (e.g. css\=h1) but that is a bit ugly if needed often.
My proposal is that in addition to the existing =, we allow using : like name:value (or name: value or even name : value as we allow spaces to used with = too). The reason I propose : is that it's visually quite close to =, it's used by Robot on the command like (e.g. -v name:value), and it's also used by Python in similarly as = in some contexts (e.g.{'name': 'value'} and dict(name=value)). We don't need to deprecate the current syntax at least now, but documentation should be written so that the new syntax is recommended.
This change causes backwards incompatibility problems if someone has used a default locator (e.g. id) which has : in its value like Click Element foo:bar. We don't expect : to be too common in locator values, and there's always a possibility to use id:foo:bar or id=foo:bar to avoid the problem. If there are lot of complaints during the SL 3.0 release candidate phase, we can still consider ways to make the transition smoother.
changed the title [-]New syntax to specify locator type in addition to current `type=value`[/-][+]New `type:value` syntax to specify locator type in addition to current `type=value`[/+]on Sep 19, 2017
changed the title [-]New `type:value` syntax to specify locator type in addition to current `type=value`[/-][+]New `strategy:value` syntax to specify locator strategy in addition to current `strategy=value`[/+]on Sep 25, 2017
This issue is now otherwise done, but table related keywords still support only the strategy=value syntax. This is due to table keywords having their own locator logic. That's a bad idea in general and #923 aims to fix it.
Activity
[-]New syntax to specify locator type in addition to current `type=value`[/-][+]New `type:value` syntax to specify locator type in addition to current `type=value`[/+]Support `:` as locator separator in addtion to `=`. See robotframewor…
Use locator prefix only if it is valid.
atests for locator parsing robotframework#908
Alternative locator syntax (#909)
[-]New `type:value` syntax to specify locator type in addition to current `type=value`[/-][+]New `strategy:value` syntax to specify locator strategy in addition to current `strategy=value`[/+]Re-wrote generic library document.
Generic library documentation update (#918)
pekkaklarck commentedon Sep 26, 2017
This issue is now otherwise done, but table related keywords still support only the
strategy=valuesyntax. This is due to table keywords having their own locator logic. That's a bad idea in general and #923 aims to fix it.aaltat commentedon Sep 26, 2017
After the #923 is merged the #926 updates the documentation.
pekkaklarck commentedon Sep 27, 2017
PR #923 fixed inconsistencies with table locators and #926 updated related docs. This issue can be considered done.