1
我即將測試與nightwatch/selenium一點下拉選擇框。 雖然測試我經歷了選擇框的選項似乎是可見的(對於測試運行者),即使它沒有被點擊。 我在HTML中很少有技能,因此我不確定這是默認行爲還是我的測試有點壞。選擇框選項是可見還是隱藏?
Testcode:
var urlToOptionsPage ='chrome-extension://dafanlbggefkfnbekjceijjhgcancpik/html/options.html';
module.exports = {
'[Options Page UI] - project list': function(browser) {
browser
.url(urlToOptionsPage)
.pause(500)
.waitForElementVisible('#projects', 5000)
.assert.value('#projects', 'BWK')
//.click('#projects')
.waitForElementVisible('#projects > option:nth-child(1)', 5000)
.end()
}
};
HTML:
<select name="projects" id="projects">
<option value="BWK">BWK</option>
<option value="DMG">DMG</option>
<option value="ABC">ABC</option>
</select>
試驗結果:
✔ Element <#projects> was visible after 52 milliseconds.
✔ Testing if value of <#projects> equals: "BWK".
✔ Element <#projects > option:nth-child(1)> was visible after 35 milliseconds.
感謝您的快速回答 – xetra11
@ xetra11非常歡迎您! –