REST Documentation

The server offers a REST API to manage the functionalities of ALEX. The documentation of this API can be found at "/restdocs/" on your running server, e.g. http://localhost:8000/restdocs.

Swagger

To create this documentation, a tool called Swagger is used together with an JavaDoc doclet which creates the files for swagger based on the code and some extra information in the JavaDoc.

Swagger

To test REST resources which require an active user, please use the login method (which does not need an active user) and copy the returned token into the api_key field on the top of the page.

Please notice: The swagger specification and the doclet both support inheritance of model classes, but the swagger-ui is incapable to render this information (there are several issues about that).

Actions

Swagger does not show the actions, so here we go. Every action has these attributes:

{
    ...
    "negated": true|false,
    "ignoreFailure": true|false,
    "disabled": true|false,
    "errorOutput": "..."
}

Web Actions

{
    "type": "web_alertAcceptDismiss",
    "action": "ACCEPT|DISMISS"
}
{
    "type": "web_alertGetText",
    "variableName": "variable"
}
{
    "type": "web_alertSendKeys",
    "text": "some text"
}
{
    "type": "web_checkForNode",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    }
}
{
    "type": "web_checkNodeAttributeValue",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "attribute": "class",
    "value": "visible",
    "checkMethod": "IS|CONTAINS|MATCHES"
}
{
    "type": "web_checkForText",
    "value": "Lorem Ipsum",
    "regexp": true|false
}
{
    "type": "web_checkPageTitle",
    "title": "page title",
    "regexp": true|false
}
{
    "type": "web_clear",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    }
}
{
    "type": "web_clickLinkByText",
    "value": "Click Me"
}
{
    "type": "web_click",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "doubleClick": true|false
}
{
    "type" : "web_fill",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "value" : "Lorem Ipsum"
}
{
    "type": "web_goto",
    "url":  "http://example.com",
    "credentials": {
      "name": "username",
      "password": "password"
    }
}
{
    "type": "web_pressKey",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "key": "ESC|ENTER|..."
}
{
    "type": "web_executeScript",
    "script": "window.alert('hi!')",
    "name": "variableName"
}
{
    "type": "web_select",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "selectBy": "VALUE|TEXT|INDEX",
    "value": "Lorem Ipsum"
}
{
    "type": "web_submit",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    }
}
{
    "type": "web_switchTo",
    "target": "PARENT_FRAME|DEFAULT_CONTENT"
}
{
    "type": "web_switchToFrame",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    }
}
{
    "type": "web_moveMouse",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "offsetX": 10,
    "offsetY": 10
}
{
    "type": "web_waitForNode",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "maxWaitTime": 2000,
    "waitCriterion": "VISIBLE|INVISIBLE|ADDED|REMOVED"
}
{
    "type": "web_waitForText",
    "node": {
      "selector": "#node",
      "type": "CSS|XPATH"
    },
    "maxWaitTime": 2000,
    "regexp": true|false,
    "value": "text to wait for"
}
{
    "type": "web_waitForTitle",
    "value": "page title",
    "maxWaitTime": 2000,
    "waitCriterion": "IS|CONTAINS"
}

Rest Actions

{
  "type" : "rest_call",
  "method" : "GET|POST|PUT|DELETE",
  "url" : "http://example.com/api",
  "data" : "{}"
}
{
  "type": "rest_checkAttributeExists",
  "attribute": "object.attribute"
}
{
  "type": "rest_checkAttributeType",
  "attribute": "object.attribute",
  "jsonType": "STRING"
}
{
  "type": "rest_checkAttributeValue",
  "attribute": "object.attribute",
  "value": "FooBar Lorem",
  "regexp": true
}
{
  "type": "rest_checkForText",
  "value": "Lorem Ipsum",
  "regexp": true
}
{
  "type": "rest_checkHeaderField",
  "key": "Key",
  "value": "Value",
  "regexp": true
}
{
  "type": "rest_checkStatus",
  "status": 200
}

Variable/ Counter Actions

{
  "type": "assertCounter",
  "name": "counter",
  "value": 4,
  "operator": "LESS_THAN|LESS_OR_EQUAL|EQUAL|GREATER_OR_EQUAL|GREATER_THAN"
}
{
  "type": "assertVariable",
  "name": "variable",
  "value": "value",
  "regexp": true|false
}
{
  "type": "incrementCounter",
  "name": "counter",
  "incrementBy": 1
}
{
  "type": "setCounter",
  "name": "counter",
  "valueType": "NUMBER|VARIABLE",
  "value": 42|"variableName"
}
{
  "type": "setVariable",
  "name": "variable",
  "value": "foobar"
}
{
  "type": "setVariableByCookie",
  "cookieType": "WEB|REST",
  "name": "variable",
  "value": "foobar"
}
{
  "type": "setVariableByHTML",
  "name": "variable",
  "node": {
    "selector": "#node",
    "type": "CSS|XPATH"
  }
}
{
  "type": "setVariableByJSON",
  "name": "variable",
  "value": "foobar"
}
{
  "type": "setVariableByNodeAttribute",
  "name": "variable",
  "node": {
    "selector": "#node",
    "type": "CSS|XPATH"
  },
  "attribute": "href" 
}
{
  "type": "setVariableByNodeCount",
  "name": "variable",
  "node": {
    "selector": "#node",
    "type": "CSS|XPATH"
  }
}
{
  "type": "setVariableByRegexGroup",
  "name": "variable",
  "regex": "^foo(.*?)bar",
  "nthMatch": 1,
  "mthGroup": 1
}

Misc. Actions

{
    "type": "wait",
    "duration": 1000
}

results matching ""

    No results matching ""