Class BrowserClickTarget

  • All Implemented Interfaces:

    
    public final class BrowserClickTarget
    
                        

    Where to act: either a viewport coordinate or an element reference.

    • Constructor Detail

    • Method Detail

      • ref

         final Optional<BrowserRefTarget> ref()

        An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

      • asRef

         final BrowserRefTarget asRef()

        An element on the page, identified by a reference from a prior read_page or find result. 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.

      • ofRef

         final static BrowserClickTarget ofRef(BrowserRefTarget ref)

        An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.