Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Added the missing @RobotKeywordOverload. This annotation is needed to… #84

Merged
merged 3 commits into from
Aug 26, 2019

Conversation

ractoc
Copy link
Contributor

@ractoc ractoc commented Jul 30, 2019

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...

… 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" })
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String attributeName = -formating

Copy link
Contributor Author

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?

Copy link
Contributor

@YauheniPo YauheniPo Aug 5, 2019

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");
______________________^

Copy link
Contributor Author

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...

@ractoc
Copy link
Contributor Author

ractoc commented Aug 14, 2019

Can you give any indication when this will be available through mvncentral?

@Hi-Fi Hi-Fi merged commit a2a59ca into MarketSquare:develop Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants