在Selenium Webdriver中执行Js脚本

时间:2014-10-25 08:40:57

标签: javascript selenium-webdriver

我想问为什么当我执行它时,它不会将值返回到numOfPeople。非常感谢。

People.prototype.deleteAllPeople = function(){
        var numOfPeople = this.getNumOfPeole();
        for (var i = 0; i < numOfPeople; i++) {
            try{
                this.click(this.By.xpath(this.getPeopleByOrder(i) + this.classContains('padding')
                + this.xPathContainText("Delete")));
            }catch(error){
                this.log("Cannot delete people " + i);
            }
        }
    };

    People.prototype.getNumOfPeole= function(){
        return this.driver.executeScript(
            "return jQuery(function($) { "
                + 'return $("div.single-pane").length;'
                + " }); "
        );
    };

0 个答案:

没有答案