Skip to main content
Version: 24.38.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

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

this

Locator<ElementType>

value

boolean

返回:

Locator<ElementType>

默认值:

🌐 Default value:

true