Class AbstractCommand

java.lang.Object
jp.vmi.selenium.selenese.command.AbstractCommand
All Implemented Interfaces:
ArgumentInfo, ICommand
Direct Known Subclasses:
AddCollection, AddLocationStrategy, AddSelection, AddToCollection, AllowNativeXpath, AltKeyDown, AltKeyUp, AnswerOnNextNativeAlert, AnswerOnNextPrompt, Assert, Assertion, AssignId, AttachFile, BlockEndImpl, BlockStartImpl, BuiltInCommand, CaptureEntirePageScreenshot, Check, ChooseCancelOnNextConfirmation, ChooseCancelOnNextNativeAlert, ChooseCancelOnNextPrompt, ChooseOkOnNextConfirmation, ChooseOkOnNextNativeAlert, Click, ClickAt, Close, Comment, ContextMenu, ControlKeyDown, ControlKeyUp, CreateCookie, Debugger, DeleteAllVisibleCookies, DeleteCookie, DeselectPopUp, DoubleClick, DoubleClickAt, DragAndDrop, DragAndDropToObject, Echo, EditContent, ExecuteAsyncScript, ExecuteScript, FireEvent, Focus, GoBack, GotoIf, Gotolabel, Highlight, Include, KeyDown, KeyPress, KeyUp, Label, MetaKeyDown, MetaKeyUp, Nop, Open, OpenWindow, Pause, Refresh, RemoveAllSelections, RemoveSelection, RepeatIf, Rollup, Run, RunScript, Select, SelectFrame, SelectPopUp, SelectWindow, SetCursorPosition, SetSpeed, SetTimeout, SetWindowSize, ShiftKeyDown, ShiftKeyUp, Store, StoreJson, Submit, Type, TypeKeys, Uncheck, UseXpathLibrary, WaitForCondition, WaitForPageToLoad, WaitForPopUp, WindowFocus, WindowMaximize

public abstract class AbstractCommand
extends Object
implements ICommand
Base implementation of command.
  • Constructor Details

    • AbstractCommand

      public AbstractCommand​(int index, String name, String[] args, ArgumentType... argTypes)
      Constructor.
      Parameters:
      index - command index.
      name - command name.
      args - command args.
      argTypes - command argument types.
  • Method Details

    • getSource

      public final String[] getSource()
      Description copied from interface: ICommand
      Get source elements.
      Specified by:
      getSource in interface ICommand
      Returns:
      array of source elements. (always 3 elements)
    • getIndex

      public int getIndex()
      Description copied from interface: ICommand
      Get index in selenese script file (1 origin).
      Specified by:
      getIndex in interface ICommand
      Returns:
      index.
    • getName

      public String getName()
      Description copied from interface: ICommand
      Get command name.
      Specified by:
      getName in interface ICommand
      Returns:
      command name.
    • getArguments

      public String[] getArguments()
      Description copied from interface: ICommand
      Get command arguments.
      Specified by:
      getArguments in interface ICommand
      Returns:
      command arguments.
    • getVariableResolvedArguments

      public String[] getVariableResolvedArguments​(SourceType sourceType, VarsMap varsMap)
      Description copied from interface: ICommand
      Get command arguments where variables resolved.
      Specified by:
      getVariableResolvedArguments in interface ICommand
      Parameters:
      sourceType - source type.
      varsMap - map of variables.
      Returns:
      arguments.
    • convertLocators

      @Deprecated public String[] convertLocators​(String[] args)
      Deprecated.
      Description copied from interface: ICommand
      Convert locators from arguments.
      Specified by:
      convertLocators in interface ICommand
      Parameters:
      args - the command arguments.
      Returns:
      converted locators.
    • extractLocators

      public Locator[] extractLocators​(String[] args)
      Description copied from interface: ICommand
      Extract locators from arguments.
      Specified by:
      extractLocators in interface ICommand
      Parameters:
      args - the command arguments.
      Returns:
      extracted parsed locators.
    • mayUpdateScreen

      public boolean mayUpdateScreen()
      Description copied from interface: ICommand
      May the command update screen?
      Specified by:
      mayUpdateScreen in interface ICommand
      Returns:
      true if the command may update screen.
    • executeImpl

      protected abstract Result executeImpl​(Context context, String... curArgs)
    • execute

      public final Result execute​(Context context, String... curArgs)
      Description copied from interface: ICommand
      Execute the command.

      Note: set the command result to testCase in this method.

      Specified by:
      execute in interface ICommand
      Parameters:
      context - Selenese Runner context.
      curArgs - current arugments. (the variables in it are extracted)
      Returns:
      the command result.
    • getResult

      public Result getResult()
      Description copied from interface: ICommand
      Get the command result.
      Specified by:
      getResult in interface ICommand
      Returns:
      the command result.
    • setBlockStart

      public void setBlockStart​(BlockStart blockStart)
      Description copied from interface: ICommand
      Set beginning-of-block command.
      Specified by:
      setBlockStart in interface ICommand
      Parameters:
      blockStart - beginning-of-block command.
    • getBlockStart

      public BlockStart getBlockStart()
      Description copied from interface: ICommand
      Get beginning-of-block command.
      Specified by:
      getBlockStart in interface ICommand
      Returns:
      beginning-of-block command.
    • setStartLoop

      public final void setStartLoop​(StartLoop startLoop)
      Description copied from interface: ICommand
      Set beginning-of-loop command.
      Specified by:
      setStartLoop in interface ICommand
      Parameters:
      startLoop - beginning-of-loop command.
    • getStartLoop

      public final StartLoop getStartLoop()
      Description copied from interface: ICommand
      Get beginning-of-loop command.
      Specified by:
      getStartLoop in interface ICommand
      Returns:
      beginning-of-loop command.
    • addScreenshot

      public void addScreenshot​(String path, String label)
      Description copied from interface: ICommand
      Add screenshot image.
      Specified by:
      addScreenshot in interface ICommand
      Parameters:
      path - image path.
      label - image label.
    • getScreenshots

      public List<Screenshot> getScreenshots()
      Description copied from interface: ICommand
      Get list of screenshot images.
      Specified by:
      getScreenshots in interface ICommand
      Returns:
      list of image path of sreenshot.
    • setSideCommand

      public void setSideCommand​(SideCommand sideCommand)
      Description copied from interface: ICommand
      Set side command.
      Specified by:
      setSideCommand in interface ICommand
      Parameters:
      sideCommand - SIDE command.
    • toString

      public String toString()
      Overrides:
      toString in class Object