1
我正在做一些使用Rspec和Watir的自動化測試。
我目前想要做的是驗證是否存在標題爲hidden
的按鈕元素的屬性。因此,在僞代碼,我想這樣做:
Rspec;驗證一個元素的狀態,當屬性沒有值
Find button element; press click
Verify button element now has another attribute titled "hidden"
perform further actions
是否有可能找到這種性質的屬性,還是他們總是需要這樣說hidden=hidden
?
對於RSpec,[謂詞匹配器](https://www.relishapp.com/rspec/rspec-expectations/v/3-4/docs/built-in-matchers/predicate-matchers)可能更好 - 'expect(browser.button).to be_hidden' –
@Justin Ko:Good call。試圖保持簡單。我已更新您的建議。 – orde
謝謝,這個作品 - 我需要做一些重構來利用語法糖,但總體來說#hidden?作品! – kmancusi