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

Commit a2a59ca

Browse files
authored
Merge pull request #84 from ractoc/develop
Added the missing @RobotKeywordOverload. This annotation is needed to…
2 parents 6b85626 + 786a4eb commit a2a59ca

File tree

1 file changed

+8
-18
lines changed
  • src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords

1 file changed

+8
-18
lines changed

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

Lines changed: 8 additions & 18 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,14 +433,15 @@ 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" })
448-
public String getElementAttribute(String locator, String attribute) {
436+
@ArgumentNames({ "locator", "attribute=None" })
437+
public String getElementAttribute(String locator, String... attribute) {
438+
String attributeName = robot.getParamsValue(attribute, 0, "None");
449439
List<WebElement> elements = elementFind(locator, true, false);
450440

451441
if (elements.size() == 0) {
452442
throw new SeleniumLibraryNonFatalException(String.format("Element '%s' not found.", locator));
453443
}
454-
return elements.get(0).getAttribute(attribute);
444+
return elements.get(0).getAttribute(attributeName);
455445
}
456446

457447
@RobotKeyword("Clears the text from element identified by ``locator``.\r\n" +

0 commit comments

Comments
 (0)