@@ -44,16 +44,26 @@ public void type() throws Exception {
4444
4545 final WebDriver webDriver = loadPage2 (html );
4646 final WebElement input = webDriver .findElement (By .id ("t" ));
47+
4748 input .sendKeys ("abc" );
48- assertEquals ("abc" , input .getAttribute ("value" ));
49+ assertNull (input .getDomAttribute ("value" ));
50+ assertEquals ("abc" , input .getDomProperty ("value" ));
51+
4952 input .sendKeys (Keys .BACK_SPACE );
50- assertEquals ("ab" , input .getAttribute ("value" ));
53+ assertNull (input .getDomAttribute ("value" ));
54+ assertEquals ("ab" , input .getDomProperty ("value" ));
55+
5156 input .sendKeys (Keys .BACK_SPACE );
52- assertEquals ("a" , input .getAttribute ("value" ));
57+ assertNull (input .getDomAttribute ("value" ));
58+ assertEquals ("a" , input .getDomProperty ("value" ));
59+
5360 input .sendKeys (Keys .BACK_SPACE );
54- assertEquals ("" , input .getAttribute ("value" ));
61+ assertNull (input .getDomAttribute ("value" ));
62+ assertEquals ("" , input .getDomProperty ("value" ));
63+
5564 input .sendKeys (Keys .BACK_SPACE );
56- assertEquals ("" , input .getAttribute ("value" ));
65+ assertNull (input .getDomAttribute ("value" ));
66+ assertEquals ("" , input .getDomProperty ("value" ));
5767 }
5868
5969 @ Test
@@ -121,7 +131,7 @@ public void getVisibleText() throws Exception {
121131 * @throws Exception if the test fails
122132 */
123133 @ Test
124- @ Alerts ("" )
134+ @ Alerts ({ "1234567" , "" } )
125135 public void clearInput () throws Exception {
126136 final String htmlContent
127137 = "<html>\n "
@@ -135,8 +145,12 @@ public void clearInput() throws Exception {
135145 final WebDriver driver = loadPage2 (htmlContent );
136146 final WebElement element = driver .findElement (By .id ("tester" ));
137147
148+ assertEquals (getExpectedAlerts ()[0 ], element .getDomAttribute ("value" ));
149+ assertEquals (getExpectedAlerts ()[0 ], element .getDomProperty ("value" ));
150+
138151 element .clear ();
139- assertEquals (getExpectedAlerts ()[0 ], element .getAttribute ("value" ));
152+ assertEquals (getExpectedAlerts ()[0 ], element .getDomAttribute ("value" ));
153+ assertEquals (getExpectedAlerts ()[1 ], element .getDomProperty ("value" ));
140154 }
141155
142156 /**
@@ -153,8 +167,10 @@ public void typing() throws Exception {
153167 final WebDriver driver = loadPage2 (htmlContent );
154168
155169 final WebElement input = driver .findElement (By .id ("foo" ));
170+
156171 input .sendKeys ("hello" );
157- assertEquals ("hello" , input .getAttribute ("value" ));
172+ assertNull (input .getDomAttribute ("value" ));
173+ assertEquals ("hello" , input .getDomProperty ("value" ));
158174 }
159175
160176 /**
@@ -188,6 +204,7 @@ public void minMaxStep() throws Exception {
188204 */
189205 @ Test
190206 @ Alerts ({"0987654321!" ,
207+ "0987654321!" ,
191208 "false" ,
192209 "false-false-true-false-false-false-false-false-false-false-false" ,
193210 "true" ,
@@ -202,6 +219,7 @@ public void patternValidationInvalid() throws Exception {
202219 */
203220 @ Test
204221 @ Alerts ({"68746d6c756e69742072756c657a21" ,
222+ "68746d6c756e69742072756c657a21" ,
205223 "true" ,
206224 "false-false-false-false-false-false-false-false-false-true-false" ,
207225 "true" ,
@@ -216,6 +234,7 @@ public void patternValidationValid() throws Exception {
216234 */
217235 @ Test
218236 @ Alerts ({"" ,
237+ "" ,
219238 "true" ,
220239 "false-false-false-false-false-false-false-false-false-true-false" ,
221240 "true" ,
@@ -229,6 +248,7 @@ public void patternValidationEmpty() throws Exception {
229248 */
230249 @ Test
231250 @ Alerts ({" " ,
251+ " " ,
232252 "false" ,
233253 "false-false-true-false-false-false-false-false-false-false-false" ,
234254 "true" ,
@@ -242,6 +262,7 @@ public void patternValidationBlank() throws Exception {
242262 */
243263 @ Test
244264 @ Alerts ({" \t " ,
265+ " \t " ,
245266 "false" ,
246267 "false-false-true-false-false-false-false-false-false-false-false" ,
247268 "true" ,
@@ -255,6 +276,7 @@ public void patternValidationWhitespace() throws Exception {
255276 */
256277 @ Test
257278 @ Alerts ({" 210 " ,
279+ " 210 " ,
258280 "true" ,
259281 "false-false-false-false-false-false-false-false-false-true-false" ,
260282 "true" ,
@@ -267,7 +289,8 @@ public void patternValidationTrimInitial() throws Exception {
267289 * @throws Exception if an error occurs
268290 */
269291 @ Test
270- @ Alerts ({" 210 " ,
292+ @ Alerts ({"null" ,
293+ " 210 " ,
271294 "true" ,
272295 "false-false-false-false-false-false-false-false-false-true-false" ,
273296 "true" ,
@@ -280,7 +303,8 @@ public void patternValidationTrimType() throws Exception {
280303 * @throws Exception if an error occurs
281304 */
282305 @ Test
283- @ Alerts ({"abcd" ,
306+ @ Alerts ({"null" ,
307+ "abcd" ,
284308 "false" ,
285309 "false-false-false-false-false-false-false-true-false-false-false" ,
286310 "true" ,
@@ -294,6 +318,7 @@ public void minLengthValidationInvalid() throws Exception {
294318 */
295319 @ Test
296320 @ Alerts ({"1234" ,
321+ "1234" ,
297322 "true" ,
298323 "false-false-false-false-false-false-false-false-false-true-false" ,
299324 "true" ,
@@ -306,7 +331,8 @@ public void minLengthValidationInvalidInitial() throws Exception {
306331 * @throws Exception if an error occurs
307332 */
308333 @ Test
309- @ Alerts ({"" ,
334+ @ Alerts ({"null" ,
335+ "" ,
310336 "true" ,
311337 "false-false-false-false-false-false-false-false-false-true-false" ,
312338 "true" ,
@@ -319,7 +345,8 @@ public void minLengthValidationInvalidNoInitial() throws Exception {
319345 * @throws Exception if an error occurs
320346 */
321347 @ Test
322- @ Alerts ({"abcdefghi" ,
348+ @ Alerts ({"null" ,
349+ "abcdefghi" ,
323350 "true" ,
324351 "false-false-false-false-false-false-false-false-false-true-false" ,
325352 "true" ,
@@ -332,7 +359,8 @@ public void minLengthValidationValid() throws Exception {
332359 * @throws Exception if an error occurs
333360 */
334361 @ Test
335- @ Alerts ({"abcd" ,
362+ @ Alerts ({"null" ,
363+ "abcd" ,
336364 "true" ,
337365 "false-false-false-false-false-false-false-false-false-true-false" ,
338366 "true" ,
@@ -345,7 +373,8 @@ public void maxLengthValidationValid() throws Exception {
345373 * @throws Exception if an error occurs
346374 */
347375 @ Test
348- @ Alerts ({"abcde" ,
376+ @ Alerts ({"null" ,
377+ "abcde" ,
349378 "true" ,
350379 "false-false-false-false-false-false-false-false-false-true-false" ,
351380 "true" ,
@@ -359,6 +388,7 @@ public void maxLengthValidationInvalid() throws Exception {
359388 */
360389 @ Test
361390 @ Alerts ({"abcdefghi" ,
391+ "abcdefghi" ,
362392 "true" ,
363393 "false-false-false-false-false-false-false-false-false-true-false" ,
364394 "true" ,
@@ -403,7 +433,8 @@ public void willValidate() throws Exception {
403433 * @throws Exception if an error occurs
404434 */
405435 @ Test
406- @ Alerts ({"" ,
436+ @ Alerts ({"null" ,
437+ "" ,
407438 "true" ,
408439 "false-false-false-false-false-false-false-false-false-true-false" ,
409440 "true" ,
@@ -416,7 +447,8 @@ public void validationEmpty() throws Exception {
416447 * @throws Exception if an error occurs
417448 */
418449 @ Test
419- @ Alerts ({"" ,
450+ @ Alerts ({"null" ,
451+ "" ,
420452 "false" ,
421453 "false-true-false-false-false-false-false-false-false-false-false" ,
422454 "true" ,
@@ -429,7 +461,8 @@ public void validationCustomValidity() throws Exception {
429461 * @throws Exception if an error occurs
430462 */
431463 @ Test
432- @ Alerts ({"" ,
464+ @ Alerts ({"null" ,
465+ "" ,
433466 "false" ,
434467 "false-true-false-false-false-false-false-false-false-false-false" ,
435468 "true" ,
@@ -442,7 +475,8 @@ public void validationBlankCustomValidity() throws Exception {
442475 * @throws Exception if an error occurs
443476 */
444477 @ Test
445- @ Alerts ({"" ,
478+ @ Alerts ({"null" ,
479+ "" ,
446480 "true" ,
447481 "false-false-false-false-false-false-false-false-false-true-false" ,
448482 "true" ,
@@ -456,7 +490,8 @@ public void validationResetCustomValidity() throws Exception {
456490 * @throws Exception if an error occurs
457491 */
458492 @ Test
459- @ Alerts ({"" ,
493+ @ Alerts ({"null" ,
494+ "" ,
460495 "false" ,
461496 "false-false-false-false-false-false-false-false-false-false-true" ,
462497 "true" ,
@@ -469,7 +504,8 @@ public void validationRequired() throws Exception {
469504 * @throws Exception if an error occurs
470505 */
471506 @ Test
472- @ Alerts ({"" ,
507+ @ Alerts ({"null" ,
508+ "" ,
473509 "true" ,
474510 "false-false-false-false-false-false-false-false-false-true-false" ,
475511 "true" ,
@@ -482,7 +518,8 @@ public void validationRequiredValueSet() throws Exception {
482518 * @throws Exception if an error occurs
483519 */
484520 @ Test
485- @ Alerts ({"" ,
521+ @ Alerts ({"null" ,
522+ "" ,
486523 "false" ,
487524 "false-false-true-false-false-false-false-false-false-false-false" ,
488525 "true" ,
@@ -540,13 +577,14 @@ private void validation(final String htmlPart, final String jsPart, final String
540577 if (sendKeys != null ) {
541578 foo .sendKeys (sendKeys );
542579 }
543- assertEquals (getExpectedAlerts ()[0 ], foo .getAttribute ("value" ));
580+ assertEquals (getExpectedAlerts ()[0 ], "" + foo .getDomAttribute ("value" ));
581+ assertEquals (getExpectedAlerts ()[1 ], foo .getDomProperty ("value" ));
544582
545583 driver .findElement (By .id ("myTest" )).click ();
546- verifyTitle2 (driver , getExpectedAlerts ()[1 ], getExpectedAlerts ()[2 ], getExpectedAlerts ()[3 ]);
584+ verifyTitle2 (driver , getExpectedAlerts ()[2 ], getExpectedAlerts ()[3 ], getExpectedAlerts ()[4 ]);
547585
548586 driver .findElement (By .id ("myButton" )).click ();
549- assertEquals (getExpectedAlerts ()[4 ], getMockWebConnection ().getLastWebRequest ().getUrl ());
550- assertEquals (Integer .parseInt (getExpectedAlerts ()[5 ]), getMockWebConnection ().getRequestCount ());
587+ assertEquals (getExpectedAlerts ()[5 ], getMockWebConnection ().getLastWebRequest ().getUrl ());
588+ assertEquals (Integer .parseInt (getExpectedAlerts ()[6 ]), getMockWebConnection ().getRequestCount ());
551589 }
552590}
0 commit comments