I have below code in nodejs for selenium using soda script.

If you see my script below, look for verifyData()
There is row testing happening for fixed columns values. I want to generate 
these asserts dynamically, only row number will vary column will always 
same, how to achieve this. I can pass row number to this methods.


Second thing, if you see with assert I used function(), can we capture 
err/assertfail here? 


    var browser = soda.createClient({
    .....
    });
    
    browser 
        .chain
        .session()  
        .setSpeed(speed)
        .setTimeout(2000)
        .open('/')
        .and(login('dev', 'x1212GQsdtpS'))
        .and(verifyData())
        .end(function(err){
            console.log('error');
       
        });
    
    function login(user, pass) {
      return function(browser) {
        browser
        .click('css=a#loginButton')
        .type('css=input.input-medium.email',user)
        .type('css=input.input.pwd',pass)
        .clickAndWait('css=a.btn.login')
        .assertTextPresent('Clients',function(){ console.log('logged in 
ok')})
      }
    }
    
    
    function verifyData() {
      return function(browser) {
        browser
        //Row 1 testing
        .assertText('css=div.keyYears table tbody tr:nth-child(1) 
td:nth-child(3)','some text',function(){ console.log('looks good')})
        .assertText('css=div.keyYears table tbody tr:nth-child(1) 
td:nth-child(5)','some text')
        .assertText('css=div.keyYears table tbody tr:nth-child(1) 
td:nth-child(6)','some text')
        .assertText('css=div.keyYears table tbody tr:nth-child(1) 
td:nth-child(7)','some text')
        //Row 2 testing
        .assertText('css=div.keyYears table tbody tr:nth-child(2) 
td:nth-child(3)','some text1',function(){ console.log('looks good')})
        .assertText('css=div.keyYears table tbody tr:nth-child(2) 
td:nth-child(5)','some text1')
        .assertText('css=div.keyYears table tbody tr:nth-child(2) 
td:nth-child(6)','some text1')
        .assertText('css=div.keyYears table tbody tr:nth-child(2) 
td:nth-child(7)','some text1')
        
      }
    }

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to