所以基本上我已經開始使用PageObjects,並且遇到了一些問題。如何在Nightwatch.js的部分中使用命令?
我想直接在某些部分執行命令。例如 - 我想
.waitForElementVisible
直接在部分(不在元素)。它甚至有可能嗎?我已經嘗試了很多組合,例如:browser.page.topMenu()section.loginBox.section.unauthenticated.waitForElementVisible( '@ loginTooltip',10000)
所以。看起來像這樣:topMenu()
是我的pageObject文件,然後有loginBox
節包含 - >unauthenticated
節包含 - >loginTooltip
部分。我想在最後一節中提供.waitForElementVisible
。這個怎麼做?我知道我可以毫無限制地組合我的部分,但以後如何處理它們?
- [會說這個問題是獎金,因爲它與標題中的問題沒有關係] 我在對節中的節進行斷言時遇到問題。這個怎麼做?我已經嘗試了很多辦法,其中之一是以下:
browser.page.topMenu().expect.section('@loginBox').to.be.visible
- 這工作 - 因爲它是唯一一個部分
browser.page.topMenu().expect.section('@loginBox').section('@unauthenticated').to.be.visible
- 不行 - 我要檢查,如果節unauthenticated
這在loginBox
裏面是可見的。這個怎麼做?
在此先感謝所有的答案,我試圖自己弄清楚這一點,但沒有任何成功。