1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.general;
16
17 import org.htmlunit.WebDriverTestCase;
18 import org.htmlunit.junit.BrowserRunner;
19 import org.htmlunit.junit.annotation.Alerts;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22
23
24
25
26
27
28
29 @RunWith(BrowserRunner.class)
30 public class ElementOuterHtmlTest extends WebDriverTestCase {
31
32 private void test(final String elementName) throws Exception {
33 final String html = DOCTYPE_HTML
34 + "<html><head>\n"
35 + " <script>\n"
36 + LOG_TITLE_FUNCTION
37 + " function test() {\n"
38 + " var value = document.createElement('" + elementName + "').outerHTML;\n"
39 + " value = value.replace('<?XML:NAMESPACE PREFIX = PUBLIC NS = \"URN:COMPONENT\" />', '');\n"
40 + " value = value.replace('<?XML:NAMESPACE PREFIX = \"PUBLIC\" NS = \"URN:COMPONENT\" />', '');\n"
41 + " log(value);\n"
42 + " }\n"
43 + " </script>\n"
44 + "</head>\n"
45 + "<body onload='test()'></body></html>";
46
47 loadPageVerifyTitle2(html);
48 }
49
50
51
52
53 @Test
54 @Alerts("<abbr></abbr>")
55 public void abbr() throws Exception {
56 test("abbr");
57 }
58
59
60
61
62 @Test
63 @Alerts("<acronym></acronym>")
64 public void acronym() throws Exception {
65 test("acronym");
66 }
67
68
69
70
71 @Test
72 @Alerts("<a></a>")
73 public void a() throws Exception {
74 test("a");
75 }
76
77
78
79
80 @Test
81 @Alerts("<address></address>")
82 public void address() throws Exception {
83 test("address");
84 }
85
86
87
88
89 @Test
90 @Alerts("<applet></applet>")
91 public void applet() throws Exception {
92 test("applet");
93 }
94
95
96
97
98 @Test
99 @Alerts("<area>")
100 public void area() throws Exception {
101 test("area");
102 }
103
104
105
106
107 @Test
108 @Alerts("<article></article>")
109 public void article() throws Exception {
110 test("article");
111 }
112
113
114
115
116 @Test
117 @Alerts("<aside></aside>")
118 public void aside() throws Exception {
119 test("aside");
120 }
121
122
123
124
125 @Test
126 @Alerts("<audio></audio>")
127 public void audio() throws Exception {
128 test("audio");
129 }
130
131
132
133
134 @Test
135 @Alerts("<bgsound>")
136 public void bgsound() throws Exception {
137 test("bgsound");
138 }
139
140
141
142
143 @Test
144 @Alerts("<base>")
145 public void base() throws Exception {
146 test("base");
147 }
148
149
150
151
152 @Test
153 @Alerts("<basefont>")
154 public void basefont() throws Exception {
155 test("basefont");
156 }
157
158
159
160
161 @Test
162 @Alerts("<bdi></bdi>")
163 public void bdi() throws Exception {
164 test("bdi");
165 }
166
167
168
169
170 @Test
171 @Alerts("<bdo></bdo>")
172 public void bdo() throws Exception {
173 test("bdo");
174 }
175
176
177
178
179 @Test
180 @Alerts("<big></big>")
181 public void big() throws Exception {
182 test("big");
183 }
184
185
186
187
188 @Test
189 @Alerts("<blink></blink>")
190 public void blink() throws Exception {
191 test("blink");
192 }
193
194
195
196
197 @Test
198 @Alerts("<blockquote></blockquote>")
199 public void blockquote() throws Exception {
200 test("blockquote");
201 }
202
203
204
205
206 @Test
207 @Alerts("<body></body>")
208 public void body() throws Exception {
209 test("body");
210 }
211
212
213
214
215 @Test
216 @Alerts("<b></b>")
217 public void b() throws Exception {
218 test("b");
219 }
220
221
222
223
224 @Test
225 @Alerts("<br>")
226 public void br() throws Exception {
227 test("br");
228 }
229
230
231
232
233 @Test
234 @Alerts("<button></button>")
235 public void button() throws Exception {
236 test("button");
237 }
238
239
240
241
242 @Test
243 @Alerts("<canvas></canvas>")
244 public void canvas() throws Exception {
245 test("canvas");
246 }
247
248
249
250
251 @Test
252 @Alerts("<caption></caption>")
253 public void caption() throws Exception {
254 test("caption");
255 }
256
257
258
259
260 @Test
261 @Alerts("<center></center>")
262 public void center() throws Exception {
263 test("center");
264 }
265
266
267
268
269 @Test
270 @Alerts("<cite></cite>")
271 public void cite() throws Exception {
272 test("cite");
273 }
274
275
276
277
278 @Test
279 @Alerts("<code></code>")
280 public void code() throws Exception {
281 test("code");
282 }
283
284
285
286
287 @Test
288 @Alerts("<col>")
289 public void col() throws Exception {
290 test("col");
291 }
292
293
294
295
296 @Test
297 @Alerts("<colgroup></colgroup>")
298 public void colgroup() throws Exception {
299 test("colgroup");
300 }
301
302
303
304
305 @Test
306 @Alerts("<command></command>")
307 public void command() throws Exception {
308 test("command");
309 }
310
311
312
313
314 @Test
315 @Alerts("<datalist></datalist>")
316 public void datalist() throws Exception {
317 test("datalist");
318 }
319
320
321
322
323 @Test
324 @Alerts("<dfn></dfn>")
325 public void dfn() throws Exception {
326 test("dfn");
327 }
328
329
330
331
332 @Test
333 @Alerts("<dd></dd>")
334 public void dd() throws Exception {
335 test("dd");
336 }
337
338
339
340
341 @Test
342 @Alerts("<del></del>")
343 public void del() throws Exception {
344 test("del");
345 }
346
347
348
349
350 @Test
351 @Alerts("<details></details>")
352 public void details() throws Exception {
353 test("details");
354 }
355
356
357
358
359 @Test
360 @Alerts("<dialog></dialog>")
361 public void dialog() throws Exception {
362 test("dialog");
363 }
364
365
366
367
368 @Test
369 @Alerts("<dir></dir>")
370 public void dir() throws Exception {
371 test("dir");
372 }
373
374
375
376
377 @Test
378 @Alerts("<div></div>")
379 public void div() throws Exception {
380 test("div");
381 }
382
383
384
385
386 @Test
387 @Alerts("<dl></dl>")
388 public void dl() throws Exception {
389 test("dl");
390 }
391
392
393
394
395 @Test
396 @Alerts("<dt></dt>")
397 public void dt() throws Exception {
398 test("dt");
399 }
400
401
402
403
404 @Test
405 @Alerts("<embed>")
406 public void embed() throws Exception {
407 test("embed");
408 }
409
410
411
412
413 @Test
414 @Alerts("<em></em>")
415 public void em() throws Exception {
416 test("em");
417 }
418
419
420
421
422 @Test
423 @Alerts("<fieldset></fieldset>")
424 public void fieldset() throws Exception {
425 test("fieldset");
426 }
427
428
429
430
431 @Test
432 @Alerts("<figcaption></figcaption>")
433 public void figcaption() throws Exception {
434 test("figcaption");
435 }
436
437
438
439
440 @Test
441 @Alerts("<figure></figure>")
442 public void figure() throws Exception {
443 test("figure");
444 }
445
446
447
448
449 @Test
450 @Alerts("<font></font>")
451 public void font() throws Exception {
452 test("font");
453 }
454
455
456
457
458 @Test
459 @Alerts("<form></form>")
460 public void form() throws Exception {
461 test("form");
462 }
463
464
465
466
467 @Test
468 @Alerts("<footer></footer>")
469 public void footer() throws Exception {
470 test("footer");
471 }
472
473
474
475
476 @Test
477 @Alerts("<frame>")
478 public void frame() throws Exception {
479 test("frame");
480 }
481
482
483
484
485 @Test
486 @Alerts("<frameset></frameset>")
487 public void frameset() throws Exception {
488 test("frameset");
489 }
490
491
492
493
494 @Test
495 @Alerts("<h1></h1>")
496 public void h1() throws Exception {
497 test("h1");
498 }
499
500
501
502
503 @Test
504 @Alerts("<h2></h2>")
505 public void h2() throws Exception {
506 test("h2");
507 }
508
509
510
511
512 @Test
513 @Alerts("<h3></h3>")
514 public void h3() throws Exception {
515 test("h3");
516 }
517
518
519
520
521 @Test
522 @Alerts("<h4></h4>")
523 public void h4() throws Exception {
524 test("h4");
525 }
526
527
528
529
530 @Test
531 @Alerts("<h5></h5>")
532 public void h5() throws Exception {
533 test("h5");
534 }
535
536
537
538
539 @Test
540 @Alerts("<h6></h6>")
541 public void h6() throws Exception {
542 test("h6");
543 }
544
545
546
547
548 @Test
549 @Alerts("<head></head>")
550 public void head() throws Exception {
551 test("head");
552 }
553
554
555
556
557 @Test
558 @Alerts("<header></header>")
559 public void header() throws Exception {
560 test("header");
561 }
562
563
564
565
566 @Test
567 @Alerts("<hr>")
568 public void hr() throws Exception {
569 test("hr");
570 }
571
572
573
574
575 @Test
576 @Alerts("<html></html>")
577 public void html() throws Exception {
578 test("html");
579 }
580
581
582
583
584 @Test
585 @Alerts("<iframe></iframe>")
586 public void iframe() throws Exception {
587 test("iframe");
588 }
589
590
591
592
593 @Test
594 @Alerts("<q></q>")
595 public void q() throws Exception {
596 test("q");
597 }
598
599
600
601
602 @Test
603 @Alerts("<ruby></ruby>")
604 public void ruby() throws Exception {
605 test("ruby");
606 }
607
608
609
610
611 @Test
612 @Alerts("<rt></rt>")
613 public void rt() throws Exception {
614 test("rt");
615 }
616
617
618
619
620 @Test
621 @Alerts("<rtc></rtc>")
622 public void rtc() throws Exception {
623 test("rtc");
624 }
625
626
627
628
629
630 @Test
631 @Alerts("<rb></rb>")
632 public void rb() throws Exception {
633 test("rb");
634 }
635
636
637
638
639 @Test
640 @Alerts("<rbc></rbc>")
641 public void rbc() throws Exception {
642 test("rbc");
643 }
644
645
646
647
648 @Test
649 @Alerts("<rp></rp>")
650 public void rp() throws Exception {
651 test("rp");
652 }
653
654
655
656
657 @Test
658 @Alerts("<image></image>")
659 public void image() throws Exception {
660 test("image");
661 }
662
663
664
665
666 @Test
667 @Alerts("<img>")
668 public void img() throws Exception {
669 test("img");
670 }
671
672
673
674
675 @Test
676 @Alerts("<ins></ins>")
677 public void ins() throws Exception {
678 test("ins");
679 }
680
681
682
683
684 @Test
685 @Alerts("<isindex></isindex>")
686 public void isindex() throws Exception {
687 test("isindex");
688 }
689
690
691
692
693 @Test
694 @Alerts("<i></i>")
695 public void i() throws Exception {
696 test("i");
697 }
698
699
700
701
702 @Test
703 @Alerts("<kbd></kbd>")
704 public void kbd() throws Exception {
705 test("kbd");
706 }
707
708
709
710
711 @Test
712 @Alerts("<keygen>")
713 public void keygen() throws Exception {
714 test("keygen");
715 }
716
717
718
719
720 @Test
721 @Alerts("<label></label>")
722 public void label() throws Exception {
723 test("label");
724 }
725
726
727
728
729 @Test
730 @Alerts("<layer></layer>")
731 public void layer() throws Exception {
732 test("layer");
733 }
734
735
736
737
738 @Test
739 @Alerts("<legend></legend>")
740 public void legend() throws Exception {
741 test("legend");
742 }
743
744
745
746
747 @Test
748 @Alerts("<listing></listing>")
749 public void listing() throws Exception {
750 test("listing");
751 }
752
753
754
755
756 @Test
757 @Alerts("<li></li>")
758 public void li() throws Exception {
759 test("li");
760 }
761
762
763
764
765 @Test
766 @Alerts("<link>")
767 public void link() throws Exception {
768 test("link");
769 }
770
771
772
773
774 @Test
775 @Alerts("<main></main>")
776 public void main() throws Exception {
777 test("main");
778 }
779
780
781
782
783 @Test
784 @Alerts("<map></map>")
785 public void map() throws Exception {
786 test("map");
787 }
788
789
790
791
792 @Test
793 @Alerts("<marquee></marquee>")
794 public void marquee() throws Exception {
795 test("marquee");
796 }
797
798
799
800
801 @Test
802 @Alerts("<mark></mark>")
803 public void mark() throws Exception {
804 test("mark");
805 }
806
807
808
809
810 @Test
811 @Alerts("<menu></menu>")
812 public void menu() throws Exception {
813 test("menu");
814 }
815
816
817
818
819 @Test
820 @Alerts("<menuitem></menuitem>")
821 public void menuitem() throws Exception {
822 test("menuitem");
823 }
824
825
826
827
828 @Test
829 @Alerts("<meta>")
830 public void meta() throws Exception {
831 test("meta");
832 }
833
834
835
836
837 @Test
838 @Alerts("<meter></meter>")
839 public void meter() throws Exception {
840 test("meter");
841 }
842
843
844
845
846 @Test
847 @Alerts("<multicol></multicol>")
848 public void multicol() throws Exception {
849 test("multicol");
850 }
851
852
853
854
855 @Test
856 @Alerts("<nav></nav>")
857 public void nav() throws Exception {
858 test("nav");
859 }
860
861
862
863
864 @Test
865 @Alerts("<nextid></nextid>")
866 public void nextid() throws Exception {
867 test("nextid");
868 }
869
870
871
872
873 @Test
874 @Alerts("<nobr></nobr>")
875 public void nobr() throws Exception {
876 test("nobr");
877 }
878
879
880
881
882 @Test
883 @Alerts("<noembed></noembed>")
884 public void noembed() throws Exception {
885 test("noembed");
886 }
887
888
889
890
891 @Test
892 @Alerts("<noframes></noframes>")
893 public void noframes() throws Exception {
894 test("noframes");
895 }
896
897
898
899
900 @Test
901 @Alerts("<noscript></noscript>")
902 public void noscript() throws Exception {
903 test("noscript");
904 }
905
906
907
908
909 @Test
910 @Alerts("<nolayer></nolayer>")
911 public void nolayer() throws Exception {
912 test("nolayer");
913 }
914
915
916
917
918 @Test
919 @Alerts("<object></object>")
920 public void object() throws Exception {
921 test("object");
922 }
923
924
925
926
927 @Test
928 @Alerts("<ol></ol>")
929 public void ol() throws Exception {
930 test("ol");
931 }
932
933
934
935
936 @Test
937 @Alerts("<optgroup></optgroup>")
938 public void optgroup() throws Exception {
939 test("optgroup");
940 }
941
942
943
944
945 @Test
946 @Alerts("<option></option>")
947 public void option() throws Exception {
948 test("option");
949 }
950
951
952
953
954 @Test
955 @Alerts("<output></output>")
956 public void output() throws Exception {
957 test("output");
958 }
959
960
961
962
963 @Test
964 @Alerts("<p></p>")
965 public void p() throws Exception {
966 test("p");
967 }
968
969
970
971
972 @Test
973 @Alerts("<param>")
974 public void param() throws Exception {
975 test("param");
976 }
977
978
979
980
981 @Test
982 @Alerts("<plaintext></plaintext>")
983 public void plaintext() throws Exception {
984 test("plaintext");
985 }
986
987
988
989
990 @Test
991 @Alerts("<pre></pre>")
992 public void pre() throws Exception {
993 test("pre");
994 }
995
996
997
998
999 @Test
1000 @Alerts("<progress></progress>")
1001 public void progress() throws Exception {
1002 test("progress");
1003 }
1004
1005
1006
1007
1008 @Test
1009 @Alerts("<s></s>")
1010 public void s() throws Exception {
1011 test("s");
1012 }
1013
1014
1015
1016
1017 @Test
1018 @Alerts("<samp></samp>")
1019 public void samp() throws Exception {
1020 test("samp");
1021 }
1022
1023
1024
1025
1026 @Test
1027 @Alerts("<script></script>")
1028 public void script() throws Exception {
1029 test("script");
1030 }
1031
1032
1033
1034
1035 @Test
1036 @Alerts("<section></section>")
1037 public void section() throws Exception {
1038 test("section");
1039 }
1040
1041
1042
1043
1044 @Test
1045 @Alerts("<select></select>")
1046 public void select() throws Exception {
1047 test("select");
1048 }
1049
1050
1051
1052
1053 @Test
1054 @Alerts("<small></small>")
1055 public void small() throws Exception {
1056 test("small");
1057 }
1058
1059
1060
1061
1062 @Test
1063 @Alerts("<source>")
1064 public void source() throws Exception {
1065 test("source");
1066 }
1067
1068
1069
1070
1071 @Test
1072 @Alerts("<spacer></spacer>")
1073 public void spacer() throws Exception {
1074 test("spacer");
1075 }
1076
1077
1078
1079
1080 @Test
1081 @Alerts("<span></span>")
1082 public void span() throws Exception {
1083 test("span");
1084 }
1085
1086
1087
1088
1089 @Test
1090 @Alerts("<strike></strike>")
1091 public void strike() throws Exception {
1092 test("strike");
1093 }
1094
1095
1096
1097
1098 @Test
1099 @Alerts("<strong></strong>")
1100 public void strong() throws Exception {
1101 test("strong");
1102 }
1103
1104
1105
1106
1107 @Test
1108 @Alerts("<style></style>")
1109 public void style() throws Exception {
1110 test("style");
1111 }
1112
1113
1114
1115
1116 @Test
1117 @Alerts("<sub></sub>")
1118 public void sub() throws Exception {
1119 test("sub");
1120 }
1121
1122
1123
1124
1125 @Test
1126 @Alerts("<summary></summary>")
1127 public void summary() throws Exception {
1128 test("summary");
1129 }
1130
1131
1132
1133
1134 @Test
1135 @Alerts("<sup></sup>")
1136 public void sup() throws Exception {
1137 test("sup");
1138 }
1139
1140
1141
1142
1143 @Test
1144 @Alerts("<svg></svg>")
1145 public void svg() throws Exception {
1146 test("svg");
1147 }
1148
1149
1150
1151
1152 @Test
1153 @Alerts("<table></table>")
1154 public void table() throws Exception {
1155 test("table");
1156 }
1157
1158
1159
1160
1161 @Test
1162 @Alerts("<tbody></tbody>")
1163 public void tbody() throws Exception {
1164 test("tbody");
1165 }
1166
1167
1168
1169
1170 @Test
1171 @Alerts("<td></td>")
1172 public void td() throws Exception {
1173 test("td");
1174 }
1175
1176
1177
1178
1179 @Test
1180 @Alerts("<th></th>")
1181 public void th() throws Exception {
1182 test("th");
1183 }
1184
1185
1186
1187
1188 @Test
1189 @Alerts("<tr></tr>")
1190 public void tr() throws Exception {
1191 test("tr");
1192 }
1193
1194
1195
1196
1197 @Test
1198 @Alerts("<track>")
1199 public void track() throws Exception {
1200 test("track");
1201 }
1202
1203
1204
1205
1206 @Test
1207 @Alerts("<textarea></textarea>")
1208 public void textarea() throws Exception {
1209 test("textarea");
1210 }
1211
1212
1213
1214
1215 @Test
1216 @Alerts("<tfoot></tfoot>")
1217 public void tfoot() throws Exception {
1218 test("tfoot");
1219 }
1220
1221
1222
1223
1224 @Test
1225 @Alerts("<thead></thead>")
1226 public void thead() throws Exception {
1227 test("thead");
1228 }
1229
1230
1231
1232
1233 @Test
1234 @Alerts("<tt></tt>")
1235 public void tt() throws Exception {
1236 test("tt");
1237 }
1238
1239
1240
1241
1242 @Test
1243 @Alerts("<time></time>")
1244 public void time() throws Exception {
1245 test("time");
1246 }
1247
1248
1249
1250
1251 @Test
1252 @Alerts("<title></title>")
1253 public void title() throws Exception {
1254 test("title");
1255 }
1256
1257
1258
1259
1260 @Test
1261 @Alerts("<u></u>")
1262 public void u() throws Exception {
1263 test("u");
1264 }
1265
1266
1267
1268
1269 @Test
1270 @Alerts("<ul></ul>")
1271 public void ul() throws Exception {
1272 test("ul");
1273 }
1274
1275
1276
1277
1278 @Test
1279 @Alerts("<var></var>")
1280 public void var() throws Exception {
1281 test("var");
1282 }
1283
1284
1285
1286
1287 @Test
1288 @Alerts("<video></video>")
1289 public void video() throws Exception {
1290 test("video");
1291 }
1292
1293
1294
1295
1296 @Test
1297 @Alerts("<wbr>")
1298 public void wbr() throws Exception {
1299 test("wbr");
1300 }
1301
1302
1303
1304
1305 @Test
1306 @Alerts("<xmp></xmp>")
1307 public void xmp() throws Exception {
1308 test("xmp");
1309 }
1310
1311
1312
1313
1314 @Test
1315 @Alerts("<input>")
1316 public void input() throws Exception {
1317 test("input");
1318 }
1319
1320
1321
1322
1323 @Test
1324 @Alerts("<data></data>")
1325 public void data() throws Exception {
1326 test("data");
1327 }
1328
1329
1330
1331
1332 @Test
1333 @Alerts("<content></content>")
1334 public void content() throws Exception {
1335 test("content");
1336 }
1337
1338
1339
1340
1341 @Test
1342 @Alerts("<picture></picture>")
1343 public void picture() throws Exception {
1344 test("picture");
1345 }
1346
1347
1348
1349
1350 @Test
1351 @Alerts("<template></template>")
1352 public void template() throws Exception {
1353 test("template");
1354 }
1355
1356
1357
1358
1359 @Test
1360 @Alerts("<slot></slot>")
1361 public void slot() throws Exception {
1362 test("slot");
1363 }
1364
1365
1366
1367
1368 @Test
1369 @Alerts("<abcdefg></abcdefg>")
1370 public void arbitrary() throws Exception {
1371 test("abcdefg");
1372 }
1373 }