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

Commit 9e2f4f0

Browse files
author
schrm01
committed
The attribute name is now determined dynamically, as per the comment from @YauheniPo.
1 parent d7a23e4 commit 9e2f4f0

File tree

1 file changed

+3
-2
lines changed
  • src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,14 @@ public String getElementAttribute(String locator) {
434434
"\r\n" +
435435
"Passing attribute name as part of the locator was removed in SeleniumLibrary 3.2. The explicit attribute argument should be used instead.")
436436
@ArgumentNames({ "locator", "attribute=None" })
437-
public String getElementAttribute(String locator, String attribute) {
437+
public String getElementAttribute(String locator, String... attribute) {
438+
String attributeName= robot.getParamsValue(attribute, 0, "None");
438439
List<WebElement> elements = elementFind(locator, true, false);
439440

440441
if (elements.size() == 0) {
441442
throw new SeleniumLibraryNonFatalException(String.format("Element '%s' not found.", locator));
442443
}
443-
return elements.get(0).getAttribute(attribute);
444+
return elements.get(0).getAttribute(attributeName);
444445
}
445446

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

0 commit comments

Comments
 (0)