Skip to main content
Version: 23.8.0

Locator.setEnsureElementIsInTheViewport() 方法

¥Locator.setEnsureElementIsInTheViewport() method

通过克隆当前定位器并指定定位器是否应将元素滚动到视口中(如果元素尚未在视口中)来创建一个新的定位器实例。

¥Creates a new locator instance by cloning the current locator and specifying whether the locator should scroll the element into viewport if it is not in the viewport already.

签名

¥Signature

class Locator {
setEnsureElementIsInTheViewport<ElementType extends Element>(
this: Locator<ElementType>,
value: boolean,
): Locator<ElementType>;
}

参数

¥Parameters

范围

类型

描述

this

定位器<元素类型>

value

boolean

Returns:

Locator<ElementType>

默认值:

¥Default value:

true