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

Commit d7a23e4

Browse files
author
schrm01
committed
Added the missing @RobotKeywordOverload. This annotation is needed to enable the overloading of the getElementByKeyword method in Robot Framework.
1 parent 6b85626 commit d7a23e4

File tree

1 file changed

+5
-16
lines changed
  • src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords

1 file changed

+5
-16
lines changed

src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords/Element.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
import org.openqa.selenium.WebDriver;
1414
import org.openqa.selenium.WebElement;
1515
import org.openqa.selenium.interactions.Actions;
16-
import org.robotframework.javalib.annotation.ArgumentNames;
17-
import org.robotframework.javalib.annotation.Autowired;
18-
import org.robotframework.javalib.annotation.RobotKeyword;
19-
import org.robotframework.javalib.annotation.RobotKeywords;
16+
import org.robotframework.javalib.annotation.*;
2017

2118
import com.github.markusbernhardt.seleniumlibrary.RunOnFailureKeywordsAdapter;
2219
import com.github.markusbernhardt.seleniumlibrary.SeleniumLibraryNonFatalException;
@@ -423,17 +420,9 @@ public void elementTextShouldNotBe(String locator, String text, String...params)
423420
}
424421
}
425422

426-
@RobotKeyword("Returns the value of an element attribute.\r\n" +
427-
"\r\n" +
428-
"The ``attribute_locator`` consists of element locator followed by an @ sign and attribute name. Example: element_id@class\r\n" +
429-
"\r\n" +
430-
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.\r\n" +
431-
"\r\n" +
432-
"Passing attribute name as part of the locator was removed in SeleniumLibrary 3.2. The explicit attribute argument should be used instead.")
433-
@ArgumentNames({ "attributeLocator" })
434-
@Deprecated
435-
public String getElementAttribute(String attributeLocator) {
436-
String[] parts = parseAttributeLocator(attributeLocator);
423+
@RobotKeywordOverload
424+
public String getElementAttribute(String locator) {
425+
String[] parts = parseAttributeLocator(locator);
437426
return getElementAttribute(parts[0], parts[1]);
438427
}
439428

@@ -444,7 +433,7 @@ public String getElementAttribute(String attributeLocator) {
444433
"Example: ${id}= Get Element Attribute css:h1 id\r\n" +
445434
"\r\n" +
446435
"Passing attribute name as part of the locator was removed in SeleniumLibrary 3.2. The explicit attribute argument should be used instead.")
447-
@ArgumentNames({ "locator", "attribute" })
436+
@ArgumentNames({ "locator", "attribute=None" })
448437
public String getElementAttribute(String locator, String attribute) {
449438
List<WebElement> elements = elementFind(locator, true, false);
450439

0 commit comments

Comments
 (0)