File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
src/org/openqa/selenium/htmlunit Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,10 @@ public String getAttribute(String name) {
418
418
return element .getTextContent ();
419
419
}
420
420
421
+ if ("innerHTML" .equalsIgnoreCase (lowerName )) {
422
+ return element .asXml ();
423
+ }
424
+
421
425
if ("value" .equals (lowerName )) {
422
426
if (element instanceof HtmlTextArea ) {
423
427
return ((HtmlTextArea ) element ).getText ();
Original file line number Diff line number Diff line change 26
26
import java .util .List ;
27
27
28
28
import static org .hamcrest .Matchers .anyOf ;
29
+ import static org .hamcrest .Matchers .containsString ;
29
30
import static org .hamcrest .Matchers .equalTo ;
30
31
import static org .hamcrest .Matchers .is ;
31
32
import static org .hamcrest .Matchers .nullValue ;
@@ -226,6 +227,14 @@ public void testShouldReturnTheContentsOfATextAreaAsItsValue() {
226
227
assertThat (value , equalTo ("Example text" ));
227
228
}
228
229
230
+ @ Test
231
+ public void testShouldReturnInnerHtml () {
232
+ driver .get (pages .simpleTestPage );
233
+
234
+ String html = driver .findElement (By .id ("wrappingtext" )).getAttribute ("innerHTML" );
235
+ assertThat (html , containsString ("<tbody>" ));
236
+ }
237
+
229
238
@ Test
230
239
public void testShouldTreatReadonlyAsAValue () {
231
240
driver .get (pages .formPage );
You can’t perform that action at this time.
0 commit comments