{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.anguskit.com/schema/angusmeter/plugins/angus-selenium.json",
  "type": "object",
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "NAVIGATE",
        "GO_BACK",
        "GO_FORWARD",
        "RELOAD",
        "CLICK",
        "DOUBLE_CLICK",
        "RIGHT_CLICK",
        "SEND_KEYS",
        "SELECT",
        "CLEAR",
        "SUBMIT",
        "HOVER",
        "CHECK",
        "UNCHECK",
        "SCREENSHOT",
        "EXECUTE_SCRIPT",
        "WAIT",
        "WAIT_FOR_URL",
        "ASSERT",
        "DRAG",
        "SWITCH_FRAME",
        "SWITCH_WINDOW",
        "KEYBOARD",
        "UPLOAD",
        "SCROLL",
        "GET_COOKIE",
        "SET_COOKIE",
        "DELETE_COOKIE",
        "ALERT"
      ],
      "description": "The web action to perform (supports ${var} interpolation)"
    },
    "selector": {
      "type": "string",
      "description": "Selector expression for the target element (supports ${var} interpolation)"
    },
    "selectorType": {
      "type": "string",
      "enum": [
        "css",
        "xpath",
        "id",
        "name",
        "tagname",
        "classname"
      ],
      "default": "css",
      "description": "Strategy used to locate elements (case-insensitive)"
    },
    "value": {
      "type": "string",
      "description": "Value to send, select, or evaluate (supports ${var} interpolation)"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "URL to navigate to (supports ${var} interpolation)"
    },
    "browser": {
      "type": "string",
      "enum": [
        "chrome",
        "firefox",
        "edge"
      ],
      "default": "chrome",
      "description": "Browser to use"
    },
    "headless": {
      "type": "boolean",
      "default": true,
      "description": "Run the browser in headless mode"
    },
    "remoteUrl": {
      "type": "string",
      "format": "uri",
      "description": "Selenium Grid hub URL for remote execution"
    },
    "timeout": {
      "type": "integer",
      "default": 30000,
      "description": "Action timeout in milliseconds"
    },
    "script": {
      "type": "string",
      "description": "JavaScript to execute (supports ${var} interpolation)"
    },
    "path": {
      "type": "string",
      "description": "File path for screenshot save or file upload"
    },
    "filePath": {
      "type": "string",
      "description": "File path to upload via file input element"
    },
    "selectBy": {
      "type": "string",
      "enum": [
        "text",
        "value",
        "index"
      ],
      "default": "text",
      "description": "How to select an option: by visible text, value attribute, or index"
    },
    "condition": {
      "type": "string",
      "enum": [
        "presence",
        "visible",
        "clickable"
      ],
      "default": "presence",
      "description": "Expected condition for WAIT action"
    },
    "assertType": {
      "type": "string",
      "enum": [
        "URL",
        "TITLE",
        "VISIBLE",
        "TEXT",
        "ATTRIBUTE",
        "COUNT",
        "ENABLED",
        "CHECKED",
        "CSS_VALUE",
        "SELECTED"
      ],
      "description": "Type of assertion to evaluate"
    },
    "expected": {
      "type": "string",
      "description": "Expected value for assertion (supports ${var} interpolation)"
    },
    "attribute": {
      "type": "string",
      "description": "Attribute name for ATTRIBUTE assertion type"
    },
    "sourceSelector": {
      "type": "string",
      "description": "Source element selector for DRAG action"
    },
    "targetSelector": {
      "type": "string",
      "description": "Target element selector for DRAG action"
    },
    "key": {
      "type": "string",
      "description": "Key to press for KEYBOARD action (e.g. ENTER, TAB, ESCAPE)"
    },
    "keyboardAction": {
      "type": "string",
      "enum": [
        "press",
        "type"
      ],
      "default": "press",
      "description": "Keyboard action type: press a key or type text"
    },
    "text": {
      "type": "string",
      "description": "Text to type for KEYBOARD action"
    },
    "cookieName": {
      "type": "string",
      "description": "Cookie name for GET_COOKIE, SET_COOKIE, DELETE_COOKIE actions"
    },
    "cookieValue": {
      "type": "string",
      "description": "Cookie value for SET_COOKIE action"
    },
    "cookieDomain": {
      "type": "string",
      "description": "Cookie domain for SET_COOKIE"
    },
    "cookiePath": {
      "type": "string",
      "description": "Cookie path for SET_COOKIE (defaults to /)"
    },
    "cookieSecure": {
      "type": "boolean",
      "description": "Cookie Secure flag"
    },
    "cookieHttpOnly": {
      "type": "boolean",
      "description": "Cookie HttpOnly flag"
    },
    "cookieSameSite": {
      "type": "string",
      "enum": [
        "Strict",
        "Lax",
        "None"
      ],
      "description": "Cookie SameSite attribute"
    },
    "cookieExpires": {
      "type": "integer",
      "description": "Cookie expiration as Unix epoch seconds"
    },
    "alertAction": {
      "type": "string",
      "enum": [
        "accept",
        "dismiss",
        "getText",
        "sendKeys"
      ],
      "default": "accept",
      "description": "Action to perform on an alert dialog"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "minimum": 1,
          "description": "Viewport width in pixels"
        },
        "height": {
          "type": "integer",
          "minimum": 1,
          "description": "Viewport height in pixels"
        }
      },
      "description": "Browser viewport dimensions"
    },
    "device": {
      "type": "string",
      "description": "Chrome DevTools mobile emulation device name (e.g. 'Pixel 5', 'iPhone 12 Pro'); chrome browser only"
    },
    "userAgent": {
      "type": "string",
      "description": "Custom User-Agent header"
    },
    "scrollX": {
      "type": "integer",
      "description": "Absolute X scroll for SCROLL action"
    },
    "scrollY": {
      "type": "integer",
      "description": "Absolute Y scroll for SCROLL action"
    },
    "allowScripting": {
      "type": "boolean",
      "default": false,
      "description": "Must be true to allow EXECUTE_SCRIPT (arbitrary JS execution) — security gate"
    }
  },
  "required": [
    "action"
  ]
}
