org.specrunner.webdriver
Class AbstractPluginFind

java.lang.Object
  extended by org.specrunner.parameters.core.ParameterHolder
      extended by org.specrunner.plugins.core.AbstractPlugin
          extended by org.specrunner.plugins.core.AbstractPluginNamed
              extended by org.specrunner.plugins.core.AbstractPluginScoped
                  extended by org.specrunner.plugins.core.AbstractPluginValue
                      extended by org.specrunner.webdriver.AbstractPluginBrowserAware
                          extended by org.specrunner.webdriver.AbstractPluginFind
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin
Direct Known Subclasses:
AbstractPluginCheck, AbstractPluginCheckable, AbstractPluginEnabled, AbstractPluginFindSingle, AbstractPluginFindSingleLocatable, PluginNotPresent, PluginPresent

public abstract class AbstractPluginFind
extends AbstractPluginBrowserAware

A partial implementation of a plugin which finds elements in pages to perform operations.

Author:
Thiago Santos

Field Summary
static String FEATURE_FINDER_INSTANCE
          Feature to set finderInstance.
static String FEATURE_FINDER_TYPE
          Feature to set finder type.
protected  String finder
          The finder class name.
protected  IFinder finderInstance
          A finder instance.
 
Fields inherited from class org.specrunner.webdriver.AbstractPluginBrowserAware
FEATURE_DIR, FEATURE_INTERVAL, FEATURE_MAXWAIT, FEATURE_TIMEOUT, FEATURE_WAITFOR
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_WAIT
 
Constructor Summary
AbstractPluginFind()
          Default constructor.
 
Method Summary
 String asString(org.openqa.selenium.WebElement element)
          Show the element as Strings.
protected  void doEnd(IContext context, IResultSet result, org.openqa.selenium.WebDriver client)
          Method delegation which receives the browser to be used by subclasses.
 String getFinder()
          The finder type.
 IFinder getFinderInstance()
          Sets the plugin finderInstance.
 IFinder getFinderInstance(IContext context)
          Propagate parameters added to finderInstance.
protected  String getText(org.openqa.selenium.WebElement element)
          Get the value of element.
 void initialize(IContext context)
           
protected abstract  void process(IContext context, IResultSet result, org.openqa.selenium.WebDriver client, org.openqa.selenium.WebElement[] elements)
          Method delegation which receives the elements to be used by subclasses.
 void setFinder(String finder)
          Set the finder type.
 void setFinderInstance(IFinder finder)
          Set the finder.
 
Methods inherited from class org.specrunner.webdriver.AbstractPluginBrowserAware
doEnd, getBrowserName, getDir, getDownload, getInterval, getMaxwait, getWaitCondition, getWaitfor, isWaitForClient, setDir, setDownload, setInterval, setMaxwait, setWaitfor, waitForClient
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginValue
getValue, getValue, isEval, setEval, setValue
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginScoped
getScope, saveGlobal, saveLocal, saveStrict, setScope
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginNamed
getName, setName
 
Methods inherited from class org.specrunner.plugins.core.AbstractPlugin
copy, doStart, getCondition, getConditionModel, getNormalized, getNormalized, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, setCondition, setConditionModel, setNormalized, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModel, toString
 
Methods inherited from class org.specrunner.parameters.core.ParameterHolder
getParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.specrunner.parameters.IParameterHolder
getParameters, setParameters
 
Methods inherited from interface org.specrunner.plugins.IActionType
getActionType
 

Field Detail

FEATURE_FINDER_TYPE

public static final String FEATURE_FINDER_TYPE
Feature to set finder type.


finder

protected String finder
The finder class name.


FEATURE_FINDER_INSTANCE

public static final String FEATURE_FINDER_INSTANCE
Feature to set finderInstance.


finderInstance

protected IFinder finderInstance
A finder instance.

Constructor Detail

AbstractPluginFind

public AbstractPluginFind()
Default constructor.

Method Detail

getFinder

public String getFinder()
The finder type.

Returns:
The finder type.

setFinder

public void setFinder(String finder)
Set the finder type.

Parameters:
finder - The type.

getFinderInstance

public IFinder getFinderInstance()
Sets the plugin finderInstance.

Returns:
The finderInstance.

setFinderInstance

public void setFinderInstance(IFinder finder)
Set the finder.

Parameters:
finder - A finder.

getFinderInstance

public IFinder getFinderInstance(IContext context)
                          throws PluginException
Propagate parameters added to finderInstance.

Parameters:
context - The context.
Returns:
The finder configured.
Throws:
PluginException - On processing errors.

initialize

public void initialize(IContext context)
                throws PluginException
Specified by:
initialize in interface IPlugin
Overrides:
initialize in class AbstractPluginBrowserAware
Throws:
PluginException

doEnd

protected void doEnd(IContext context,
                     IResultSet result,
                     org.openqa.selenium.WebDriver client)
              throws PluginException
Description copied from class: AbstractPluginBrowserAware
Method delegation which receives the browser to be used by subclasses.

Specified by:
doEnd in class AbstractPluginBrowserAware
Parameters:
context - The test context.
result - The result set.
client - The browser.
Throws:
PluginException - On execution errors.

process

protected abstract void process(IContext context,
                                IResultSet result,
                                org.openqa.selenium.WebDriver client,
                                org.openqa.selenium.WebElement[] elements)
                         throws PluginException
Method delegation which receives the elements to be used by subclasses.

Parameters:
context - The test context.
result - The result set.
client - The browser.
elements - The elements filtered by search strategy.
Throws:
PluginException - On execution errors.

asString

public String asString(org.openqa.selenium.WebElement element)
Show the element as Strings.

Parameters:
element - The element.
Returns:
A string representation.

getText

protected String getText(org.openqa.selenium.WebElement element)
Get the value of element. Depends on element type.

Parameters:
element - The element.
Returns:
The value.


Copyright © 2013. All rights reserved.