2017-04-05 71 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 
    }) 
相關問題