2017-04-05 69 views
0

我有一个页面对象如何使用nightwatch.js页面对象上的元素列表?

export default { 
    url: function() { 

    return `${this.api.launch_url}/custompage`; 

    }, 
    commands: [customPageCommands], 
    sections: { 
    table: { 
     selector: '.table tbody', 
     elements: { 
     tableRows: { 
      selector: 'td' 
     } 
     } 
    } 
    } 
}; 

tableRows应该返回元素的列表。在我的测试中,我想检查表格中的行数。有人有解决这个问题吗?

回答

0

有一个函数调用元素(),你可以在你的页面对象试试这个(包括这customPageCommands):

this.api.elements('css selector', ".table tbody td",function(result){ 
     console.log(result.value) // this should contains rows detail 
    }) 
相关问题