我正在測試基於服務調用和http get的響應填充3個複選框的場景。如何在執行量角器e2e測試之前等待下拉人口?
我遇到的是當我運行測試protractor conf.js
下拉菜單尚未填充來自http get響應的響應,所以當我嘗試測試任何瀏覽器停止並且測試失敗時。
有沒有辦法讓量角器可以在運行測試之前對這些下拉列表進行填充?
conf.js:
// An example configuration file.
exports.config = {
//directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine 2 is recommended.
framework: 'jasmine2',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['e2e/*.js'],
baseUrl: 'http://localhost:4000/',
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
test file:
var select = element(by.model('make'));
console.log(select);
select.$('[value="acura"]').click();
失敗上的click事件,因爲當這個測試運行選擇沒有選項元素的選擇會從一個JSON HTTP GET響應填充。
在此先感謝!
沒有幫助,我曾試圖之前 – pj013
訪問的選擇應該通過量角器完成,使用 'browser.driver.isElementPresent(elementToFind)。然後(函數(isPresent){ 元素(elementToFind)。單擊 }' –