0
A
回答
1
是的,你可以得到幾個輸入值:
第一個選項是回調(不推薦):
var text, text2, text3; // ...
browser.getValue('#inputField1', function (result) {
text = result.value;
browser.getValue('#inputField2', function (result) {
text2 = result.value;
browser.getValue('#inputField3', function (result) {
text3 = result.value;
browser.getValue('#inputField4' + text3, function (result) {
console.log(text, text2, text3) // your code
});
});
});
});
二,可以使用pe rform()從文件API(推薦):
var text, text2, text3;
browser
.getValue('#input', function (result) {
text = result.value;
browser.getValue('#inputField2', function (result) {
text2 = result.value;
});
})
.perform(function() {
browser.getValue('#inputField3', function (result) {
console.log(text2, text 1) // they do exist here
text3 = result.value;
});
});
這是文檔從nightwatch Perform
1
您可以使用gettext或getValue方法,例如:
this.demoTest = function (browser) {
browser.getText("#main ul li a.first", function(result) {
this.assert.equal(typeof result, "object");
this.assert.equal(result.status, 0);
this.assert.equal(result.value, "nightwatchjs.org");
});
};
this.demoTest = function (browser) {
browser.getValue("form.login input[type=text]", function(result) {
this.assert.equal(typeof result, "object");
this.assert.equal(result.status, 0);
this.assert.equal(result.value, "enter username");
});
};
有API文檔:getText API reference
相關問題
- 1. Theano卷積:TypeError:conv2d()得到了多個值的參數'輸入'
- 2. 得到一個隱藏的輸入值
- 3. 鏈接,卻得到了輸入
- 4. 我的輸出跳過了我輸入的幾個短語
- 5. 如何獲得元素nightwatchjs
- 6. 得到檢查輸入值到陣列
- 7. 輸入引導多日期值到幾個SQL記錄
- 8. 得到輸入值並更改div
- 9. 在keydown/keypress後得到輸入值
- 10. JavaScript沒有得到輸入框的值
- 11. Jquery獲得輸入的輸入值
- 12. 我的代碼輸出了幾個「Array」
- 13. 得到一個隱藏的輸入字段的多個值
- 14. 爲了計算損失函數對幾個輸入的推斷
- 15. 如何檢查是否輸入了一個值使用輸入
- 16. 將輸入雙倍值與幾個已知值進行比較
- 17. 得到那個加入了2桌
- 18. document.getElementById沒有得到新輸入的HTML文本輸入值
- 19. 得到輸入值的* ngFor生成輸入在離子2
- 20. Jquery通過TD最接近的輸入得到輸入值
- 21. 引入nokogiri我怎麼得到這個值了
- 22. 爲了得到角色相當於幾個C
- 23. 使用原矩陣得到了幾個新的矩陣
- 24. 插入一個值到輸入
- 25. 得到一個輸入數字的值jQuery中
- 26. simple_html_dom得到一個帶有部分id值的輸入
- 27. jQuery的輸入值比較只得到一個數字
- 28. 當onfocus和調用令牌輸入時得到另一個值
- 29. 在兩個輸入字段之間得到最大值
- 30. 得到一個輸入值變化事件