2626import java .util .List ;
2727import java .util .concurrent .Callable ;
2828
29+ import org .htmlunit .ScriptResult ;
30+ import org .htmlunit .corejs .javascript .Scriptable ;
31+ import org .htmlunit .corejs .javascript .ScriptableObject ;
32+ import org .htmlunit .html .DisabledElement ;
33+ import org .htmlunit .html .DomElement ;
34+ import org .htmlunit .html .DomNode ;
35+ import org .htmlunit .html .HtmlButton ;
36+ import org .htmlunit .html .HtmlCheckBoxInput ;
37+ import org .htmlunit .html .HtmlElement ;
38+ import org .htmlunit .html .HtmlFileInput ;
39+ import org .htmlunit .html .HtmlForm ;
40+ import org .htmlunit .html .HtmlImageInput ;
41+ import org .htmlunit .html .HtmlInput ;
42+ import org .htmlunit .html .HtmlOption ;
43+ import org .htmlunit .html .HtmlPage ;
44+ import org .htmlunit .html .HtmlRadioButtonInput ;
45+ import org .htmlunit .html .HtmlSelect ;
46+ import org .htmlunit .html .HtmlSubmitInput ;
47+ import org .htmlunit .html .HtmlTextArea ;
48+ import org .htmlunit .html .impl .SelectableTextInput ;
49+ import org .htmlunit .javascript .host .html .HTMLElement ;
50+ import org .htmlunit .javascript .host .html .HTMLInputElement ;
2951import org .openqa .selenium .By ;
3052import org .openqa .selenium .Dimension ;
3153import org .openqa .selenium .ElementNotInteractableException ;
4769import org .w3c .dom .Attr ;
4870import org .w3c .dom .NamedNodeMap ;
4971
50- import org .htmlunit .ScriptResult ;
51- import org .htmlunit .html .DisabledElement ;
52- import org .htmlunit .html .DomElement ;
53- import org .htmlunit .html .DomNode ;
54- import org .htmlunit .html .HtmlButton ;
55- import org .htmlunit .html .HtmlElement ;
56- import org .htmlunit .html .HtmlFileInput ;
57- import org .htmlunit .html .HtmlForm ;
58- import org .htmlunit .html .HtmlImageInput ;
59- import org .htmlunit .html .HtmlInput ;
60- import org .htmlunit .html .HtmlOption ;
61- import org .htmlunit .html .HtmlPage ;
62- import org .htmlunit .html .HtmlSelect ;
63- import org .htmlunit .html .HtmlSubmitInput ;
64- import org .htmlunit .html .HtmlTextArea ;
65- import org .htmlunit .html .impl .SelectableTextInput ;
66- import org .htmlunit .javascript .host .html .HTMLElement ;
67- import org .htmlunit .javascript .host .html .HTMLInputElement ;
68-
69- import org .htmlunit .corejs .javascript .Scriptable ;
70- import org .htmlunit .corejs .javascript .ScriptableObject ;
71-
7272/**
7373 *
7474 * @author Alexei Barantsev
@@ -385,16 +385,26 @@ public String getDomProperty(final String name) {
385385
386386 final String lowerName = name .toLowerCase ();
387387 final String value = element_ .getAttribute (lowerName );
388- if (ATTRIBUTE_NOT_DEFINED == value ) {
389- return null ;
390- }
391388
392389 if ("disabled" .equals (lowerName )) {
393390 if (element_ instanceof DisabledElement ) {
394- return trueOrNull (((DisabledElement ) element_ ).isDisabled ());
391+ return trueOrFalse (((DisabledElement ) element_ ).isDisabled ());
392+ }
393+ }
394+
395+ if ("checked" .equals (lowerName )) {
396+ if (element_ instanceof HtmlCheckBoxInput ) {
397+ return trueOrFalse (((HtmlCheckBoxInput ) element_ ).isChecked ());
398+ }
399+ else if (element_ instanceof HtmlRadioButtonInput ) {
400+ return trueOrFalse (((HtmlRadioButtonInput ) element_ ).isChecked ());
395401 }
396402 }
397403
404+ if (ATTRIBUTE_NOT_DEFINED == value ) {
405+ return null ;
406+ }
407+
398408 if (ATTRIBUTE_VALUE_EMPTY == value ) {
399409 return null ;
400410 }
@@ -418,13 +428,26 @@ public String getDomAttribute(final String name) {
418428 }
419429 }
420430
431+ if ("checked" .equals (lowerName )) {
432+ if (element_ instanceof HtmlCheckBoxInput ) {
433+ return trueOrNull (((HtmlCheckBoxInput ) element_ ).isChecked ());
434+ }
435+ else if (element_ instanceof HtmlRadioButtonInput ) {
436+ return trueOrNull (((HtmlRadioButtonInput ) element_ ).isChecked ());
437+ }
438+ }
439+
421440 return value ;
422441 }
423442
424443 private static String trueOrNull (final boolean condition ) {
425444 return condition ? "true" : null ;
426445 }
427446
447+ private static String trueOrFalse (final boolean condition ) {
448+ return condition ? "true" : "false" ;
449+ }
450+
428451 @ Override
429452 public boolean isSelected () {
430453 assertElementNotStale ();
0 commit comments