commands.scm
(define click (lambda (locator) (send-command "click" locator)))
(define double-click (lambda (locator) (send-command "doubleClick" locator)))
(define click-at
  (lambda (locator coord-string)
    (send-command "clickAt" locator coord-string)))
(define double-click-at
  (lambda (locator coord-string)
    (send-command "doubleClickAt" locator coord-string)))
(define fire-event
  (lambda (locator event-name) (send-command "fireEvent" locator event-name)))
(define key-press
  (lambda (locator key-sequence)
    (send-command "keyPress" locator key-sequence)))
(define shift-key-down (lambda () (send-command "shiftKeyDown")))
(define shift-key-up (lambda () (send-command "shiftKeyUp")))
(define meta-key-down (lambda () (send-command "metaKeyDown")))
(define meta-key-up (lambda () (send-command "metaKeyUp")))
(define alt-key-down (lambda () (send-command "altKeyDown")))
(define alt-key-up (lambda () (send-command "altKeyUp")))
(define control-key-down (lambda () (send-command "controlKeyDown")))
(define control-key-up (lambda () (send-command "controlKeyUp")))
(define key-down
  (lambda (locator key-sequence)
    (send-command "keyDown" locator key-sequence)))
(define key-up
  (lambda (locator key-sequence) (send-command "keyUp" locator key-sequence)))
(define mouse-over (lambda (locator) (send-command "mouseOver" locator)))
(define mouse-out (lambda (locator) (send-command "mouseOut" locator)))
(define mouse-down (lambda (locator) (send-command "mouseDown" locator)))
(define mouse-down-at
  (lambda (locator coord-string)
    (send-command "mouseDownAt" locator coord-string)))
(define mouse-up (lambda (locator) (send-command "mouseUp" locator)))
(define mouse-up-at
  (lambda (locator coord-string)
    (send-command "mouseUpAt" locator coord-string)))
(define mouse-move (lambda (locator) (send-command "mouseMove" locator)))
(define mouse-move-at
  (lambda (locator coord-string)
    (send-command "mouseMoveAt" locator coord-string)))
(define type (lambda (locator value) (send-command "type" locator value)))
(define type-keys
  (lambda (locator value) (send-command "typeKeys" locator value)))
(define set-speed (lambda (value) (send-command "setSpeed" value)))
(define get-speed (lambda () (send-command "getSpeed")))
(define check (lambda (locator) (send-command "check" locator)))
(define uncheck (lambda (locator) (send-command "uncheck" locator)))
(define select
  (lambda (select-locator option-locator)
    (send-command "select" select-locator option-locator)))
(define add-selection
  (lambda (locator option-locator)
    (send-command "addSelection" locator option-locator)))
(define remove-selection
  (lambda (locator option-locator)
    (send-command "removeSelection" locator option-locator)))
(define remove-all-selections
  (lambda (locator) (send-command "removeAllSelections" locator)))
(define submit (lambda (form-locator) (send-command "submit" form-locator)))
(define open (lambda (url) (send-command "open" url)))
(define open-window
  (lambda (url window-i-d) (send-command "openWindow" url window-i-d)))
(define select-window
  (lambda (window-i-d) (send-command "selectWindow" window-i-d)))
(define select-frame (lambda (locator) (send-command "selectFrame" locator)))
(define get-log-messages
  (lambda () (read-response (send-command "getLogMessages") identity)))
(define get-whether-this-frame-match-frame-expression
  (lambda (current-frame-string target)
    (read-response
      (send-command
        "getWhetherThisFrameMatchFrameExpression"
        current-frame-string
        target)
      boolean)))
(define get-whether-this-window-match-window-expression
  (lambda (current-window-string target)
    (read-response
      (send-command
        "getWhetherThisWindowMatchWindowExpression"
        current-window-string
        target)
      boolean)))
(define wait-for-pop-up
  (lambda (window-i-d timeout)
    (send-command "waitForPopUp" window-i-d timeout)))
(define choose-cancel-on-next-confirmation
  (lambda () (send-command "chooseCancelOnNextConfirmation")))
(define answer-on-next-prompt
  (lambda (answer) (send-command "answerOnNextPrompt" answer)))
(define go-back (lambda () (send-command "goBack")))
(define refresh (lambda () (send-command "refresh")))
(define close (lambda () (send-command "close")))
(define is-alert-present
  (lambda () (read-response (send-command "isAlertPresent") boolean)))
(define is-prompt-present
  (lambda () (read-response (send-command "isPromptPresent") boolean)))
(define is-confirmation-present
  (lambda () (read-response (send-command "isConfirmationPresent") boolean)))
(define get-alert
  (lambda () (read-response (send-command "getAlert") identity)))
(define get-confirmation
  (lambda () (read-response (send-command "getConfirmation") identity)))
(define get-prompt
  (lambda () (read-response (send-command "getPrompt") identity)))
(define get-location
  (lambda () (read-response (send-command "getLocation") identity)))
(define get-title
  (lambda () (read-response (send-command "getTitle") identity)))
(define get-body-text
  (lambda () (read-response (send-command "getBodyText") identity)))
(define get-value
  (lambda (locator)
    (read-response (send-command "getValue" locator) identity)))
(define get-text
  (lambda (locator) (read-response (send-command "getText" locator) identity)))
(define highlight (lambda (locator) (send-command "highlight" locator)))
(define get-eval
  (lambda (script) (read-response (send-command "getEval" script) identity)))
(define is-checked
  (lambda (locator)
    (read-response (send-command "isChecked" locator) boolean)))
(define get-table
  (lambda (table-cell-address)
    (read-response (send-command "getTable" table-cell-address) identity)))
(define get-selected-labels
  (lambda (select-locator)
    (read-response
      (send-command "getSelectedLabels" select-locator)
      string-array)))
(define get-selected-label
  (lambda (select-locator)
    (read-response (send-command "getSelectedLabel" select-locator) identity)))
(define get-selected-values
  (lambda (select-locator)
    (read-response
      (send-command "getSelectedValues" select-locator)
      string-array)))
(define get-selected-value
  (lambda (select-locator)
    (read-response (send-command "getSelectedValue" select-locator) identity)))
(define get-selected-indexes
  (lambda (select-locator)
    (read-response
      (send-command "getSelectedIndexes" select-locator)
      string-array)))
(define get-selected-index
  (lambda (select-locator)
    (read-response (send-command "getSelectedIndex" select-locator) identity)))
(define get-selected-ids
  (lambda (select-locator)
    (read-response
      (send-command "getSelectedIds" select-locator)
      string-array)))
(define get-selected-id
  (lambda (select-locator)
    (read-response (send-command "getSelectedId" select-locator) identity)))
(define is-something-selected
  (lambda (select-locator)
    (read-response
      (send-command "isSomethingSelected" select-locator)
      boolean)))
(define get-select-options
  (lambda (select-locator)
    (read-response
      (send-command "getSelectOptions" select-locator)
      string-array)))
(define get-attribute
  (lambda (attribute-locator)
    (read-response (send-command "getAttribute" attribute-locator) identity)))
(define is-text-present
  (lambda (pattern)
    (read-response (send-command "isTextPresent" pattern) boolean)))
(define is-element-present
  (lambda (locator)
    (read-response (send-command "isElementPresent" locator) boolean)))
(define is-visible
  (lambda (locator)
    (read-response (send-command "isVisible" locator) boolean)))
(define is-editable
  (lambda (locator)
    (read-response (send-command "isEditable" locator) boolean)))
(define get-all-buttons
  (lambda () (read-response (send-command "getAllButtons") string-array)))
(define get-all-links
  (lambda () (read-response (send-command "getAllLinks") string-array)))
(define get-all-fields
  (lambda () (read-response (send-command "getAllFields") string-array)))
(define get-attribute-from-all-windows
  (lambda (attribute-name)
    (read-response
      (send-command "getAttributeFromAllWindows" attribute-name)
      string-array)))
(define dragdrop
  (lambda (locator movements-string)
    (send-command "dragdrop" locator movements-string)))
(define set-mouse-speed
  (lambda (pixels) (send-command "setMouseSpeed" pixels)))
(define get-mouse-speed
  (lambda () (read-response (send-command "getMouseSpeed") string->number)))
(define drag-and-drop
  (lambda (locator movements-string)
    (send-command "dragAndDrop" locator movements-string)))
(define drag-and-drop-to-object
  (lambda (locator-of-object-to-be-dragged locator-of-drag-destination-object)
    (send-command
      "dragAndDropToObject"
      locator-of-object-to-be-dragged
      locator-of-drag-destination-object)))
(define window-focus
  (lambda (window-name) (send-command "windowFocus" window-name)))
(define window-maximize
  (lambda (window-name) (send-command "windowMaximize" window-name)))
(define get-all-window-ids
  (lambda () (read-response (send-command "getAllWindowIds") string-array)))
(define get-all-window-names
  (lambda () (read-response (send-command "getAllWindowNames") string-array)))
(define get-all-window-titles
  (lambda () (read-response (send-command "getAllWindowTitles") string-array)))
(define get-html-source
  (lambda () (read-response (send-command "getHtmlSource") identity)))
(define set-cursor-position
  (lambda (locator position)
    (send-command "setCursorPosition" locator position)))
(define get-element-index
  (lambda (locator)
    (read-response (send-command "getElementIndex" locator) string->number)))
(define is-ordered
  (lambda (locator1 locator2)
    (read-response (send-command "isOrdered" locator1 locator2) boolean)))
(define get-element-position-left
  (lambda (locator)
    (read-response
      (send-command "getElementPositionLeft" locator)
      string->number)))
(define get-element-position-top
  (lambda (locator)
    (read-response
      (send-command "getElementPositionTop" locator)
      string->number)))
(define get-element-width
  (lambda (locator)
    (read-response (send-command "getElementWidth" locator) string->number)))
(define get-element-height
  (lambda (locator)
    (read-response (send-command "getElementHeight" locator) string->number)))
(define get-cursor-position
  (lambda (locator)
    (read-response (send-command "getCursorPosition" locator) string->number)))
(define set-context
  (lambda (context log-level-threshold)
    (send-command "setContext" context log-level-threshold)))
(define get-expression
  (lambda (expression)
    (read-response (send-command "getExpression" expression) identity)))
(define wait-for-condition
  (lambda (script timeout) (send-command "waitForCondition" script timeout)))
(define set-timeout (lambda (timeout) (send-command "setTimeout" timeout)))
(define wait-for-page-to-load
  (lambda (timeout) (send-command "waitForPageToLoad" timeout)))
(define get-cookie
  (lambda () (read-response (send-command "getCookie") identity)))
(define create-cookie
  (lambda (name-value-pair options-string)
    (send-command "createCookie" name-value-pair options-string)))
(define delete-cookie
  (lambda (name path) (send-command "deleteCookie" name path)))