org.specrunner.webdriver
Class PluginBrowser

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.webdriver.PluginBrowser
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin

public class PluginBrowser
extends AbstractPluginScoped

Create a web driver instance.

Author:
Thiago Santos

Field Summary
static String BROWSER_NAME
          Default browser name.
static String BROWSER_TYPE
          Suffix of browser type.
static String FEATURE_RECORDING
          Feature to enable browser recording.
static String FEATURE_REUSE
          Feature to set web driver reuse.
static String FEATURE_WEBDRIVER_FACTORY
          Feature to set webdriver factory class name.
static String FEATURE_WEBDRIVER_INSTANCE
          Feature to set web driver instance.
static String FEATURE_WEBDRIVER_TYPE
          Feature to set web driver class name.
protected  String webdriver
          The web driver class name.
protected  String webdriverfactory
          The web driver factory.
protected  org.openqa.selenium.WebDriver webdriverInstance
          The web driver instance.
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT
 
Constructor Summary
PluginBrowser()
          Creates a browser.
 
Method Summary
 ENext doStart(IContext context, IResultSet result)
           
 ActionType getActionType()
           
 Boolean getRecording()
          Get the recording status. true, for recording, false, otherwise.
 Boolean getReuse()
          Gets the reuse status.
 String getWebdriver()
          Gets web driver class name.
 String getWebdriverfactory()
          Gets web driver factory class name.
 org.openqa.selenium.WebDriver getWebdriverInstance()
          Gets the web driver instance.
 void initialize(IContext context)
           
protected  void save(IContext context, org.openqa.selenium.WebDriver driver)
          Save browser to the context.
 void setRecording(Boolean recording)
          Sets the recording status.
 void setReuse(Boolean reuse)
          Set reuse status.
 void setWebdriver(String webdriver)
          Sets class name.
 void setWebdriverfactory(String webdriverfactory)
          The web driver factory class name.
 void setWebdriverInstance(org.openqa.selenium.WebDriver webdriverInstance)
          Set the webdriver instance.
 
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, doEnd, 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
 

Field Detail

BROWSER_NAME

public static final String BROWSER_NAME
Default browser name. To set a different name use the attribute 'name=<name>'.

See Also:
Constant Field Values

BROWSER_TYPE

public static final String BROWSER_TYPE
Suffix of browser type. To see or use browser type in test use '${browser_type}' or ${_type} if a name is specified.

See Also:
Constant Field Values

FEATURE_RECORDING

public static final String FEATURE_RECORDING
Feature to enable browser recording.


FEATURE_WEBDRIVER_TYPE

public static final String FEATURE_WEBDRIVER_TYPE
Feature to set web driver class name.


webdriver

protected String webdriver
The web driver class name.


FEATURE_WEBDRIVER_FACTORY

public static final String FEATURE_WEBDRIVER_FACTORY
Feature to set webdriver factory class name.


webdriverfactory

protected String webdriverfactory
The web driver factory.


FEATURE_WEBDRIVER_INSTANCE

public static final String FEATURE_WEBDRIVER_INSTANCE
Feature to set web driver instance.


webdriverInstance

protected org.openqa.selenium.WebDriver webdriverInstance
The web driver instance.


FEATURE_REUSE

public static final String FEATURE_REUSE
Feature to set web driver reuse.

Constructor Detail

PluginBrowser

public PluginBrowser()
Creates a browser.

Method Detail

getRecording

public Boolean getRecording()
Get the recording status. true, for recording, false, otherwise.

Returns:
The recording status.

setRecording

public void setRecording(Boolean recording)
Sets the recording status.

Parameters:
recording - The status.

getWebdriver

public String getWebdriver()
Gets web driver class name.

Returns:
The web driver class.

setWebdriver

public void setWebdriver(String webdriver)
Sets class name.

Parameters:
webdriver - The class name.

getWebdriverfactory

public String getWebdriverfactory()
Gets web driver factory class name. Might implements IWebDriverFactory.

Returns:
The factory class name.

setWebdriverfactory

public void setWebdriverfactory(String webdriverfactory)
The web driver factory class name.

Parameters:
webdriverfactory - The driver factory.

getWebdriverInstance

public org.openqa.selenium.WebDriver getWebdriverInstance()
Gets the web driver instance.

Returns:
The instance.

setWebdriverInstance

public void setWebdriverInstance(org.openqa.selenium.WebDriver webdriverInstance)
Set the webdriver instance.

Parameters:
webdriverInstance - The instance.

getReuse

public Boolean getReuse()
Gets the reuse status. If reuse is true, the browser can be reused by multiple tests if the browser name is the same.

Returns:
The reuse status.

setReuse

public void setReuse(Boolean reuse)
Set reuse status.

Parameters:
reuse - Reuse status.

getActionType

public ActionType getActionType()

initialize

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

doStart

public ENext doStart(IContext context,
                     IResultSet result)
              throws PluginException
Specified by:
doStart in interface IPlugin
Overrides:
doStart in class AbstractPlugin
Throws:
PluginException

save

protected void save(IContext context,
                    org.openqa.selenium.WebDriver driver)
Save browser to the context.

Parameters:
context - The context.
driver - The driver.


Copyright © 2013. All rights reserved.