@@ -347,13 +347,69 @@ Selenium.prototype.reset = function() {
347347 this . browserbot . resetPopups ( ) ;
348348} ;
349349
350+ Selenium . prototype . doVerifyChecked = function ( locator ) {
351+ let element = this . browserbot . findElement ( locator ) ;
352+ if ( element . type !== "checkbox" && element . type !== "radio" ) {
353+ throw new Error ( `Element with locator ${ locator } is not a checkbox nor a radio button` ) ;
354+ } else if ( ! element . checked ) {
355+ throw new Error ( `Element with locator ${ locator } is not checked` ) ;
356+ }
357+ } ;
358+
359+ Selenium . prototype . doVerifyNotChecked = function ( locator ) {
360+ let element = this . browserbot . findElement ( locator ) ;
361+ if ( element . type !== "checkbox" && element . type !== "radio" ) {
362+ throw new Error ( `Element with locator ${ locator } is not a checkbox nor a radio button` ) ;
363+ } else if ( element . checked ) {
364+ throw new Error ( `Element with locator ${ locator } is checked` ) ;
365+ }
366+ } ;
367+
368+ Selenium . prototype . doVerifyEditable = function ( locator ) {
369+ if ( ! this . isEditable ( locator ) ) {
370+ throw new Error ( `Element with locator ${ locator } is not editable` ) ;
371+ }
372+ } ;
373+
374+ Selenium . prototype . doVerifyNotEditable = function ( locator ) {
375+ if ( this . isEditable ( locator ) ) {
376+ throw new Error ( `Element with locator ${ locator } is editable` ) ;
377+ }
378+ } ;
379+
380+
381+ Selenium . prototype . doVerifySelectedValue = function ( locator , value ) {
382+ let element = this . browserbot . findElement ( locator ) ;
383+ if ( element . type !== "select-one" ) {
384+ throw new Error ( `Element with locator ${ locator } is not a select` ) ;
385+ } else if ( element . value !== value ) {
386+ throw new Error ( "Actual value '" + element . value + "' did not match '" + value + "'" ) ;
387+ }
388+ } ;
389+
390+ Selenium . prototype . doVerifyNotSelectedValue = function ( locator , value ) {
391+ let element = this . browserbot . findElement ( locator ) ;
392+ if ( element . type !== "select-one" ) {
393+ throw new Error ( `Element with locator ${ locator } is not a select` ) ;
394+ } else if ( element . value === value ) {
395+ throw new Error ( "Actual value '" + element . value + "' did match" ) ;
396+ }
397+ } ;
398+
350399Selenium . prototype . doVerifyText = function ( locator , value ) {
351400 let element = this . browserbot . findElement ( locator ) ;
352401 if ( getText ( element ) !== value ) {
353402 throw new Error ( "Actual value '" + getText ( element ) + "' did not match '" + value + "'" ) ;
354403 }
355404} ;
356405
406+ Selenium . prototype . doVerifyValue = function ( locator , value ) {
407+ let element = this . browserbot . findElement ( locator ) ;
408+ if ( element . value !== value ) {
409+ throw new Error ( "Actual value '" + element . value + "' did not match '" + value + "'" ) ;
410+ }
411+ } ;
412+
357413Selenium . prototype . doVerifyTitle = function ( value ) {
358414 if ( normalizeSpaces ( this . getTitle ( ) ) !== value ) {
359415 throw new Error ( "Actual value '" + normalizeSpaces ( this . getTitle ( ) ) + "' did not match '" + value + "'" ) ;
@@ -383,13 +439,68 @@ Selenium.prototype.doVerifyElementNotPresent = function(locator) {
383439 }
384440} ;
385441
442+ Selenium . prototype . doAssertChecked = function ( locator ) {
443+ let element = this . browserbot . findElement ( locator ) ;
444+ if ( element . type !== "checkbox" && element . type !== "radio" ) {
445+ throw new Error ( `Element with locator ${ locator } is not a checkbox nor a radio button` ) ;
446+ } else if ( ! element . checked ) {
447+ throw new Error ( `Element with locator ${ locator } is not checked` ) ;
448+ }
449+ } ;
450+
451+ Selenium . prototype . doAssertNotChecked = function ( locator ) {
452+ let element = this . browserbot . findElement ( locator ) ;
453+ if ( element . type !== "checkbox" && element . type !== "radio" ) {
454+ throw new Error ( `Element with locator ${ locator } is not a checkbox nor a radio button` ) ;
455+ } else if ( element . checked ) {
456+ throw new Error ( `Element with locator ${ locator } is checked` ) ;
457+ }
458+ } ;
459+
460+ Selenium . prototype . doAssertEditable = function ( locator ) {
461+ if ( ! this . isEditable ( locator ) ) {
462+ throw new Error ( `Element with locator ${ locator } is not editable` ) ;
463+ }
464+ } ;
465+
466+ Selenium . prototype . doAssertNotEditable = function ( locator ) {
467+ if ( this . isEditable ( locator ) ) {
468+ throw new Error ( `Element with locator ${ locator } is editable` ) ;
469+ }
470+ } ;
471+
472+ Selenium . prototype . doAssertSelectedValue = function ( locator , value ) {
473+ let element = this . browserbot . findElement ( locator ) ;
474+ if ( element . type !== "select-one" ) {
475+ throw new Error ( `Element with locator ${ locator } is not a select` ) ;
476+ } else if ( element . value !== value ) {
477+ throw new Error ( "Actual value '" + element . value + "' did not match '" + value + "'" ) ;
478+ }
479+ } ;
480+
481+ Selenium . prototype . doAssertNotSelectedValue = function ( locator , value ) {
482+ let element = this . browserbot . findElement ( locator ) ;
483+ if ( element . type !== "select-one" ) {
484+ throw new Error ( `Element with locator ${ locator } is not a select` ) ;
485+ } else if ( element . value === value ) {
486+ throw new Error ( "Actual value '" + element . value + "' did match" ) ;
487+ }
488+ } ;
489+
386490Selenium . prototype . doAssertText = function ( locator , value ) {
387491 let element = this . browserbot . findElement ( locator ) ;
388492 if ( getText ( element ) !== value ) {
389493 throw new Error ( "Actual value '" + getText ( element ) + "' did not match '" + value + "'" ) ;
390494 }
391495} ;
392496
497+ Selenium . prototype . doAssertValue = function ( locator , value ) {
498+ let element = this . browserbot . findElement ( locator ) ;
499+ if ( element . value !== value ) {
500+ throw new Error ( "Actual value '" + element . value + "' did not match '" + value + "'" ) ;
501+ }
502+ } ;
503+
393504Selenium . prototype . doAssertTitle = function ( value ) {
394505 if ( normalizeSpaces ( this . getTitle ( ) ) !== value ) {
395506 throw new Error ( "Actual value '" + normalizeSpaces ( this . getTitle ( ) ) + "' did not match '" + value + "'" ) ;
0 commit comments