Skip to main content

斷言

斷言列表

斷言描述
assertThat(locator).isAttached()元素已附加
assertThat(locator).isChecked()勾選框已勾選
assertThat(locator).isDisabled()元素已停用
assertThat(locator).isEditable()元素可編輯
assertThat(locator).isEmpty()容器為空
assertThat(locator).isEnabled()元素已啟用
assertThat(locator).isFocused()元素已聚焦
assertThat(locator).isHidden()元素不可見
assertThat(locator).isInViewport()元素與檢視區相交
assertThat(locator).isVisible()元素可見
assertThat(locator).containsClass()元素具有指定的 CSS 類別
assertThat(locator).containsText()元素包含文字
assertThat(locator).hasAccessibleDescription()元素具有匹配的無障礙描述
assertThat(locator).hasAccessibleName()元素具有匹配的無障礙名稱
assertThat(locator).hasAttribute()元素具有 DOM 屬性
assertThat(locator).hasClass()元素具有 class 屬性
assertThat(locator).hasCount()清單具有確切的子項目數量
assertThat(locator).hasCSS()元素具有 CSS 屬性
assertThat(locator).hasId()元素具有 ID
assertThat(locator).hasJSProperty()元素具有 JavaScript 屬性
assertThat(locator).hasRole()元素具有特定的 ARIA 角色
assertThat(locator).hasText()元素匹配文字
assertThat(locator).hasValue()輸入具有值
assertThat(locator).hasValues()選擇具有選定的選項
assertThat(locator).matchesAriaSnapshot()元素匹配提供的 Aria 快照
assertThat(page).hasTitle()頁面具有標題
assertThat(page).hasURL()頁面具有 URL
assertThat(response).isOK()回應具有 OK 狀態