Jquery ui Casperjs和jquery ui选项卡;“正在加载…”;

Jquery ui Casperjs和jquery ui选项卡;“正在加载…”;,jquery-ui,casperjs,Jquery Ui,Casperjs,我使用casperjs获取页面上的所有jqueryui选项卡,并单击每个选项卡。问题是选项卡是动态加载的,而且似乎从未从“加载…”状态切换。我尝试过使用casperwait()函数,甚至是waitWhileSelector()函数,但两个函数都不起作用: function getActiveTab () { var active_tab = $('#tabs>ul').find('li.ui-tabs-selected').text(); console.log("Acti

我使用casperjs获取页面上的所有jqueryui选项卡,并单击每个选项卡。问题是选项卡是动态加载的,而且似乎从未从“加载…”状态切换。我尝试过使用casper
wait()
函数,甚至是
waitWhileSelector(
)函数,但两个函数都不起作用:

function getActiveTab () {
    var active_tab = $('#tabs>ul').find('li.ui-tabs-selected').text();
    console.log("Active tab: " + active_tab);
    return active_tab;
}

function clickTabs (tabs) {
    this.each(tabs, function(casper, tab_name, i){
        var child_number = i + 1;
        var tab_selector = "#tabs>ul>li:nth-child(" + child_number + ")>a";
        console.log(tab_selector);
        // this.thenClick(tab_selector).waitWhileSelector('#tabs>ul>li.ui-state-processing', function(){
        this.thenClick(tab_selector, function(){
            var this_tab = this.evaluate(getActiveTab);
        });
    });
}
它似乎适用于第一个选项卡(因为它是在页面加载时加载的选项卡),但所有其他选项卡都返回“加载”:

当我使用waitWhileSelector时,它会在第一次单击后超时。大多数选项卡都会动态加载带有dataTables对象的脚本标记,看起来要么table对象从未加载,要么dataTables库没有加载?我是否必须将该库注入evaluate方法,或者页面中的标记是否应该将其拉入


如果您能帮助我隔离此测试中发生的情况,我将不胜感激。

需要在
casperjs
选项中包含数据表的
.js
文件:
clientScripts。

------ snip passed tests ------
#tabs>ul>li:nth-child(1)>a
#tabs>ul>li:nth-child(2)>a
#tabs>ul>li:nth-child(3)>a
#tabs>ul>li:nth-child(4)>a
#tabs>ul>li:nth-child(5)>a
#tabs>ul>li:nth-child(6)>a
#tabs>ul>li:nth-child(7)>a
#tabs>ul>li:nth-child(8)>a
#tabs>ul>li:nth-child(9)>a
remote message caught: Active tab: Host Allocation
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#disk_pools_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#vvol_groups_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#arrayCablesTable').dataTable')
remote message caught: Active tab: Loadingâ¦
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#fa_information_table').dataTable')
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#zoning_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#pool_mismatch_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#other_information_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#arrayIPs').dataTable')
remote message caught: Active tab: Loadingâ¦
FAIL 12 tests executed in NaNs, 11 passed, 1 failed.