跳至主要內容
版本:23.11.1

Locator.setEnsureElementIsInTheViewport() 方法

透過複製目前的 locator 並指定 locator 是否應將元素捲動至可視範圍(如果元素尚未在可視範圍內),來建立新的 locator 實例。

簽名

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

參數

參數

類型

描述

this

Locator<ElementType>

value

boolean

回傳

Locator<ElementType>

預設值:

true