public class SessionManager
extends java.lang.Object
ThreadLocal so each
thread of test execution has its own manager instance. Based on
https://github.com/FINRAOS/JTAF-ExtWebDriver for the properties see
http://finraos.github.io/JTAF-ExtWebDriver/clientproperties.html.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BASE_URL_KEY
Key for the options to define a base-url.
|
| Modifier and Type | Method and Description |
|---|---|
WebBrowser |
getCurrentSession()
Convenience method for getting the current WebBrowser session associated
with this SessionManager, the session must exists.
|
WebBrowser |
getCurrentSession(boolean createIfNotFound)
Get the current session associated with this thread.
|
java.lang.String |
getCurrentSessionId()
Get the ID of the current WebBrowser session associated with this
SessionManager
|
java.lang.String |
getDefaultBaseUrl()
Get the default base-url.
|
static SessionManager |
getInstance()
Obtain the ThreadLocal instance of SessionManager.
|
WebBrowser |
getNewSession()
Create and return a new WebBrowser session with default options, and set
it as the current session for this SessionManager.
|
WebBrowser |
getNewSession(boolean setAsCurrent)
Create and return new WebBrowser instance with default options.
|
WebBrowser |
getNewSession(java.util.Map<java.lang.String,java.lang.String> override)
Create and return a new WebBrowser instance.
|
WebBrowser |
getNewSession(java.util.Map<java.lang.String,java.lang.String> override,
boolean setAsCurrent)
Create and return a new WebBrowser instance.
|
WebBrowser |
getNewSession(java.lang.String key,
java.lang.String value)
Create and return a new WebBrowser instance.
|
WebBrowser |
getNewSession(java.lang.String key,
java.lang.String value,
boolean setAsCurrent)
Create and return a new WebBrowser instance.
|
static WebBrowser |
getSession()
Convenience method to get the current session.
|
WebBrowser |
getSession(java.lang.String sessionId)
Get an existing WebBrowser session with the given ID.
|
java.util.Map<java.lang.String,WebBrowser> |
getSessions()
Get the Map of all WebBrowser sessions associated with this
SessionManager instance.
|
void |
quitAllSessions() |
void |
removeSession(java.lang.String sessionId)
Remove a session with the given ID from this SessionManager
|
void |
removeSession(WebBrowser session)
Remove the given session from SessionManager based on its stored ID.
|
void |
setDefaultBaseUrl(java.lang.String defaultBaseUrl)
Possibility to set the default base-url.
|
SessionManager |
setWebDriverFactory(WebDriverFactory impl)
Configure the current instance of SessionManager to use the given
WebDriverFactory instance as its WebDriverFactory, returning the newly
configured instance.
|
void |
switchToSession(java.lang.String sessionId)
Switch the current session to be the WebBrowser session with the given
ID.
|
void |
switchToSession(WebBrowser ewd)
Switch the current session to be the provided WebBrowser instance.
|
public static final java.lang.String BASE_URL_KEY
public static SessionManager getInstance()
setWebDriverFactorypublic java.lang.String getDefaultBaseUrl()
public void setDefaultBaseUrl(java.lang.String defaultBaseUrl)
defaultBaseUrl - the default base-url.public SessionManager setWebDriverFactory(WebDriverFactory impl)
impl - a WebDriverFactory instance to be associated with this
managergetInstancepublic WebBrowser getCurrentSession(boolean createIfNotFound)
createIfNotFound - set to true if a session should be created if no
session is associated with the current sessionIdgetCurrentSession(), getSession(String), switchToDefaultSession(),
switchToSession(String)public WebBrowser getCurrentSession()
public static WebBrowser getSession()
public WebBrowser getSession(java.lang.String sessionId)
sessionId - public java.util.Map<java.lang.String,WebBrowser> getSessions()
public void switchToSession(java.lang.String sessionId)
sessionId - public void switchToSession(WebBrowser ewd)
sessionId - public java.lang.String getCurrentSessionId()
public void removeSession(java.lang.String sessionId)
sessionId - the ID of the session to be removedpublic void removeSession(WebBrowser session)
session - the WebBrowser session to be removedpublic WebBrowser getNewSession() throws java.lang.Exception
java.lang.Exceptionpublic WebBrowser getNewSession(boolean setAsCurrent) throws java.lang.Exception
setAsCurrent - set to true if the new session should become the
current session for this SessionManagerjava.lang.Exceptionpublic WebBrowser getNewSession(java.lang.String key, java.lang.String value) throws java.lang.Exception
key - The key whose default value will be overriddenvalue - The value to be associated with the provided keyjava.lang.Exceptionpublic WebBrowser getNewSession(java.lang.String key, java.lang.String value, boolean setAsCurrent) throws java.lang.Exception
key - The key whose default value will be overriddenvalue - The value to be associated with the provided keysetAsCurrent - set to true if the new session should become the
current session for this SessionManagerjava.lang.Exceptionpublic WebBrowser getNewSession(java.util.Map<java.lang.String,java.lang.String> override) throws java.lang.Exception
override - A Map of options to be overriddenjava.lang.Exceptionpublic WebBrowser getNewSession(java.util.Map<java.lang.String,java.lang.String> override, boolean setAsCurrent) throws java.lang.Exception
override - A Map of options to be overriddensetAsCurrent - set to true if the new session should become the
current session for this SessionManagerjava.lang.Exceptionpublic void quitAllSessions()
Copyright © 2017 PPI AG. All rights reserved.