From f8e67389d30e033c6cf293c9f3997082a89db1e5 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Thu, 4 Nov 2021 20:02:33 +0100 Subject: [PATCH] fixes --- .../openqa/selenium/htmlunit/HtmlUnitWebElement.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openqa/selenium/htmlunit/HtmlUnitWebElement.java b/src/main/java/org/openqa/selenium/htmlunit/HtmlUnitWebElement.java index 8d51033f..b51e74b3 100644 --- a/src/main/java/org/openqa/selenium/htmlunit/HtmlUnitWebElement.java +++ b/src/main/java/org/openqa/selenium/htmlunit/HtmlUnitWebElement.java @@ -322,8 +322,12 @@ public String getAttribute(String name) { return null; } } + if ("disabled".equals(lowerName)) { - return trueOrNull(!isEnabled()); + if (element instanceof DisabledElement) { + return trueOrNull(((DisabledElement) element).isDisabled()); + } + return "true"; } if ("multiple".equals(lowerName) && element instanceof HtmlSelect) { @@ -401,7 +405,9 @@ public String getDomProperty(String name) { } if ("disabled".equals(lowerName)) { - return "true"; + if (element instanceof DisabledElement) { + return trueOrNull(((DisabledElement) element).isDisabled()); + } } if (ATTRIBUTE_VALUE_EMPTY == value) {