跳到主要内容

断言

断言列表

断言描述
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()元素具有类属性
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()响应具有成功状态码