public class SessionManager extends Object
| Modifier and Type | Method and Description |
|---|---|
ExtWebDriver |
getCurrentSession()
Convenience method for getting the current ExtWebDriver session
associated with this SessionManager, creating a new session if the
session does not exist.
|
ExtWebDriver |
getCurrentSession(boolean createIfNotFound)
Get the current session associated with this thread.
|
String |
getCurrentSessionId()
Get the ID of the current ExtWebDriver session associated with this
SessionManager
|
static SessionManager |
getInstance()
Obtain the ThreadLocal instance of SessionManager.
|
ExtWebDriver |
getNewSession()
Create and return a new ExtWebDriver session with default options, and
set it as the current session for this SessionManager.
|
ExtWebDriver |
getNewSession(boolean setAsCurrent)
Create and return new ExtWebDriver instance with default options.
|
ExtWebDriver |
getNewSession(Map<String,String> override)
Create and return a new ExtWebDriver instance.
|
ExtWebDriver |
getNewSession(Map<String,String> override,
boolean setAsCurrent)
Create and return a new ExtWebDriver instance.
|
ExtWebDriver |
getNewSession(String key,
String value)
Create and return a new ExtWebDriver instance.
|
ExtWebDriver |
getNewSession(String key,
String value,
boolean setAsCurrent)
Create and return a new ExtWebDriver instance.
|
ExtWebDriver |
getSession(String sessionId)
Get an existing ExtWebDriver session with the given ID.
|
Map<String,ExtWebDriver> |
getSessions()
Get the Map of all ExtWebDriver sessions associated with this
SessionManager instance.
|
void |
removeSession(ExtWebDriver session)
Remove the given session from SessionManager based on its stored ID.
|
void |
removeSession(String sessionId)
Remove a session with the given ID from this SessionManager
|
SessionManager |
setSessionFactory(SessionFactory impl)
Configure the current instance of SessionManager to use the given
SessionFactory instance as its SessionFactory, returning the newly
configured instance.
|
void |
switchToSession(ExtWebDriver ewd)
Switch the current session to be the provided ExtWebDriver instance.
|
void |
switchToSession(String sessionId)
Switch the current session to be the ExtWebDriver session with the given
ID.
|
public static SessionManager getInstance()
setSessionFactorypublic SessionManager setSessionFactory(SessionFactory impl)
impl - a SessionFactory instance to be associated with this managergetInstancepublic ExtWebDriver getCurrentSession(boolean createIfNotFound)
createIfNotFound - set to true if a session should be created if no session is
associated with the current sessionIdgetCurrentSession(),
getSession(String),
switchToSession(String)public ExtWebDriver getCurrentSession()
public ExtWebDriver getSession(String sessionId)
sessionId - public Map<String,ExtWebDriver> getSessions()
public void switchToSession(String sessionId)
sessionId - public void switchToSession(ExtWebDriver ewd)
ewd - public String getCurrentSessionId()
public void removeSession(String sessionId)
sessionId - the ID of the session to be removedpublic void removeSession(ExtWebDriver session)
session - the ExtWebDriver session to be removedpublic ExtWebDriver getNewSession() throws Exception
Exceptionpublic ExtWebDriver getNewSession(boolean setAsCurrent) throws Exception
setAsCurrent - set to true if the new session should become the current
session for this SessionManagerExceptionpublic ExtWebDriver getNewSession(String key, String value) throws Exception
key - The key whose default value will be overriddenvalue - The value to be associated with the provided keyExceptionpublic ExtWebDriver getNewSession(String key, String value, boolean setAsCurrent) throws 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 SessionManagerExceptionpublic ExtWebDriver getNewSession(Map<String,String> override) throws Exception
override - A Map of options to be overriddenExceptionpublic ExtWebDriver getNewSession(Map<String,String> override, boolean setAsCurrent) throws Exception
override - A Map of options to be overriddensetAsCurrent - set to true if the new session should become the current
session for this SessionManagerExceptionCopyright © 2018. All rights reserved.