Javascript 如何验证字段值是否已更改

Javascript 如何验证字段值是否已更改,javascript,protractor,Javascript,Protractor,根据添加的客人数量显示房间总数。我的问题是如何验证房间总数的值是否已更改。如果是,如何在控制台中打印它。尝试以下操作: browser.wait(function() { i++; return $('.popup-loading p').getText().then(function(content) { if (content != "the init value") { console.log("Value changed");

根据添加的客人数量显示房间总数。我的问题是如何验证房间总数的值是否已更改。如果是,如何在控制台中打印它。

尝试以下操作:

browser.wait(function() {
    i++;
    return $('.popup-loading p').getText().then(function(content) {
        if (content != "the init value") {
            console.log("Value changed");
            return true;
        } else {
            _retryOnErr();
        }
    }, _retryOnErr);
}, 3600 * 1000, 'Error waiting for element present: ').
then(function(waitRetValue) {
    return waitRetValue;
}, function(err) {
    throw err + ' after ' + i + ' iterations.';
});

您需要提供更多的细节代码示例,也许可以为我们提供一些示例代码。阅读Hello,您应该提供更多相关信息。我们无法这样帮助您。我有一个模型窗口,您可以在其中添加或删除客人,并根据该窗口,使用总价详细信息填充带有价格的客人详细信息。如何根据用户在模型窗口中选择的来宾数量验证来宾详细信息。