-
Notifications
You must be signed in to change notification settings - Fork 16
Added the missing @RobotKeywordOverload. This annotation is needed to… #84
Conversation
… enable the overloading of the getElementByKeyword method in Robot Framework.
@@ -444,7 +433,7 @@ public String getElementAttribute(String attributeLocator) { | |||
"Example: ${id}= Get Element Attribute css:h1 id\r\n" + | |||
"\r\n" + | |||
"Passing attribute name as part of the locator was removed in SeleniumLibrary 3.2. The explicit attribute argument should be used instead.") | |||
@ArgumentNames({ "locator", "attribute" }) | |||
@ArgumentNames({ "locator", "attribute=None" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My approach:
@ArgumentNames({ "locator", "attribute=None" })
public String getElementAttribute(String locator, String... attribute) {
String attribute= robot.getParamsValue(attribute, 0, "None");
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this but for some reason it wouldn't except both the version with 1 parameter and the version with 2 parameters that way. That would only work with just the String... params parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah wait, serves me right, trying to answer stuff like this without access to the code... See the fix below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, great
public String getElementAttribute(String locator, String attribute) { | ||
@ArgumentNames({ "locator", "attribute=None" }) | ||
public String getElementAttribute(String locator, String... attribute) { | ||
String attributeName= robot.getParamsValue(attribute, 0, "None"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String attributeName = -formating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String attributeName = robot.getParamsValue(attribute, 0, "None");
______________________^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah found it, space between attributeName and = sign.
And fixed...
Can you give any indication when this will be available through mvncentral? |
Added the required annoation to enable the overloading. The only downside of this is that the parameter for the attribute name needs to have an =None declared or it won't work. It is a mandatory parameter though so...