Class BrowserClickTarget
-
- All Implemented Interfaces:
public final class BrowserClickTargetWhere to act: either a viewport coordinate or an element reference.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBrowserClickTarget.VisitorAn interface that defines how to map each variant of BrowserClickTarget to a value of type T.
public final classBrowserClickTarget.Type
-
Method Summary
Modifier and Type Method Description final Optional<BrowserCoordinateTarget>coordinate()A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot). final Optional<BrowserRefTarget>ref()An element on the page, identified by a reference from a prior read_pageorfindresult.final Optional<JsonValue>_json()final BrowserClickTarget.Typetype()final BooleanisCoordinate()final BooleanisRef()final BrowserCoordinateTargetasCoordinate()A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot). final BrowserRefTargetasRef()An element on the page, identified by a reference from a prior read_pageorfindresult.final <T extends Any> Taccept(BrowserClickTarget.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BrowserClickTargetvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BrowserClickTargetofCoordinate(BrowserCoordinateTarget coordinate)A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot). final static BrowserClickTargetofRef(BrowserRefTarget ref)An element on the page, identified by a reference from a prior read_pageorfindresult.final static BrowserClickTargetofRef(String ref)Returns an immutable instance of BrowserClickTarget whose ofRef variant is built from the given required ref. -
-
Method Detail
-
coordinate
final Optional<BrowserCoordinateTarget> coordinate()
A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).
-
ref
final Optional<BrowserRefTarget> ref()
An element on the page, identified by a reference from a prior
read_pageorfindresult. References are scoped to the tab that produced them and become stale after navigation or a major re-render.
-
type
final BrowserClickTarget.Type type()
-
isCoordinate
final Boolean isCoordinate()
-
asCoordinate
final BrowserCoordinateTarget asCoordinate()
A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).
-
asRef
final BrowserRefTarget asRef()
An element on the page, identified by a reference from a prior
read_pageorfindresult. References are scoped to the tab that produced them and become stale after navigation or a major re-render.
-
accept
final <T extends Any> T accept(BrowserClickTarget.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = browserClickTarget.accept(new BrowserClickTarget.Visitor<Optional<String>>() { @Override public Optional<String> visitCoordinate(BrowserCoordinateTarget coordinate) { return Optional.of(coordinate.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BrowserClickTarget validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofCoordinate
final static BrowserClickTarget ofCoordinate(BrowserCoordinateTarget coordinate)
A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).
-
ofRef
final static BrowserClickTarget ofRef(BrowserRefTarget ref)
An element on the page, identified by a reference from a prior
read_pageorfindresult. References are scoped to the tab that produced them and become stale after navigation or a major re-render.
-
ofRef
final static BrowserClickTarget ofRef(String ref)
Returns an immutable instance of BrowserClickTarget whose ofRef variant is built from the given required ref.
-
-
-
-