WD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
webdriver::Session Class Reference

#include <webdriver_session.h>

Collaboration diagram for webdriver::Session:

Public Member Functions

 Session ()
 
 ~Session ()
 
ErrorInit (const base::DictionaryValue *desired_capabilities_dict, const base::DictionaryValue *required_capabilities_dict)
 
ErrorBeforeExecuteCommand ()
 
ErrorAfterExecuteCommand ()
 
void Terminate ()
 
base::ListValue * GetLog () const
 
void AddPerfLogEntry (LogLevel level, const std::string &message)
 
LogLevel GetMinPerfLogLevel () const
 
base::ListValue * GetPerfLog () const
 
void RunSessionTask (const base::Closure &task)
 
const std::string & id () const
 
const FramePathcurrent_frame () const
 
void set_current_frame (const FramePath &frame)
 
const ViewIdcurrent_view () const
 
void set_current_view (const ViewId &viewId)
 
void set_page_load_timeout (int timeout_ms)
 
int page_load_timeout () const
 
void set_async_script_timeout (int timeout_ms)
 
int async_script_timeout () const
 
void set_implicit_wait (int timeout_ms)
 
int implicit_wait () const
 
const Pointget_mouse_position () const
 
void set_mouse_position (const Point &point)
 
int get_sticky_modifiers () const
 
void set_sticky_modifiers (int mods)
 
const DictionaryValue * get_desired_caps () const
 
const DictionaryValue * get_required_caps () const
 
const Loggerlogger () const
 
const FilePath & temp_dir () const
 
const Capabilitiescapabilities () const
 
ViewHandleGetViewHandle (const ViewId &viewId) const
 
bool AddNewView (ViewHandle *handle, ViewId *viewId)
 
bool ReplaceViewHandle (const ViewId &viewId, ViewHandle *handle)
 
ViewId GetViewForHandle (ViewHandle *handle) const
 
void RemoveView (const ViewId &viewId)
 
void UpdateViews (const std::set< ViewId > &views)
 
ElementHandleGetElementHandle (const ViewId &viewId, const ElementId &elementId) const
 
ElementId GetElementIdForHandle (const ViewId &viewId, const ElementHandle *handle) const
 
bool AddElement (const ViewId &viewId, ElementHandle *handle, ElementId *elementId)
 
void RemoveElement (const ViewId &viewId, const ElementId &elementId)
 

Public Attributes

std::vector< ElementIdframe_elements_
 

Detailed Description

Every connection made by WebDriver maps to a session object. This object creates the browser instance and keeps track of the state necessary to control the browser created. A session manages its own lifetime.

Constructor & Destructor Documentation

webdriver::Session::Session ( )

Adds this Session to the SessionManager. The session manages its own lifetime. Call Terminate, not delete, if you need to quit.

webdriver::Session::~Session ( )

Removes this Session from the SessionManager.

Member Function Documentation

bool webdriver::Session::AddElement ( const ViewId viewId,
ElementHandle handle,
ElementId elementId 
)

Add element mapping

Parameters
viewIdtarget view
handlepointer to element handle, no need to delete
elementIdreturned elementId
Returns
true if ok
bool webdriver::Session::AddNewView ( ViewHandle handle,
ViewId viewId 
)

Put ViewHandle in map and return new ViewId for this handle

Parameters
handlehandle to put, no need to delete.
[out]viewIdreturned viewId
Returns
true if added, false if viewId already exist
void webdriver::Session::AddPerfLogEntry ( LogLevel  level,
const std::string &  message 
)
Error* webdriver::Session::AfterExecuteCommand ( )

Should be called after executing a command.

int webdriver::Session::async_script_timeout ( ) const
Error* webdriver::Session::BeforeExecuteCommand ( )

Should be called before executing a command.

const Capabilities& webdriver::Session::capabilities ( ) const
const FramePath& webdriver::Session::current_frame ( ) const
const ViewId& webdriver::Session::current_view ( ) const
const DictionaryValue* webdriver::Session::get_desired_caps ( ) const
inline
const Point& webdriver::Session::get_mouse_position ( ) const
const DictionaryValue* webdriver::Session::get_required_caps ( ) const
inline
int webdriver::Session::get_sticky_modifiers ( ) const
inline
ElementHandle* webdriver::Session::GetElementHandle ( const ViewId viewId,
const ElementId elementId 
) const

Get elementHandle for given elementId in specific view

Parameters
viewIdrequested view
elementIdrequested element
Returns
elementHandle
ElementId webdriver::Session::GetElementIdForHandle ( const ViewId viewId,
const ElementHandle handle 
) const

Get elementId for given element handle in specific view

Parameters
viewIdrequested view
handlerequested element handle
Returns
elementId
base::ListValue* webdriver::Session::GetLog ( ) const

Returns a copy of the current log entries. Caller is responsible for returned value.

LogLevel webdriver::Session::GetMinPerfLogLevel ( ) const

Return current minimum LogLevel for Performance Logging, by default kOffLogLevel.

base::ListValue* webdriver::Session::GetPerfLog ( ) const

Returns a copy of the current performance log entries.

ViewId webdriver::Session::GetViewForHandle ( ViewHandle handle) const

Check if some view maps handle

Parameters
handleto check
Returns
valid viewId if found
ViewHandle* webdriver::Session::GetViewHandle ( const ViewId viewId) const

Get ViewHandle for given ViewId

Parameters
viewIdrequested viewId
Returns
viewHandle for given viewId
const std::string& webdriver::Session::id ( ) const

Get session id

Returns
session id
int webdriver::Session::implicit_wait ( ) const
Error* webdriver::Session::Init ( const base::DictionaryValue *  desired_capabilities_dict,
const base::DictionaryValue *  required_capabilities_dict 
)

Initializes the session with the given capabilities.

const Logger& webdriver::Session::logger ( ) const
int webdriver::Session::page_load_timeout ( ) const
void webdriver::Session::RemoveElement ( const ViewId viewId,
const ElementId elementId 
)

Invalidate elementId in specific view. Remove it from map

Parameters
viewIdrequested view
elementIdelement to invalidate
void webdriver::Session::RemoveView ( const ViewId viewId)

Invalidate viewIdRemove it from map

Parameters
viewIdrequested view
bool webdriver::Session::ReplaceViewHandle ( const ViewId viewId,
ViewHandle handle 
)

Change mapping of viewId to handle

Parameters
viewIdviewId to change
handlenew handle to map
Returns
true if replaced, false if viewId not found
void webdriver::Session::RunSessionTask ( const base::Closure &  task)

Runs task in session's context

Parameters
tasktask to run
void webdriver::Session::set_async_script_timeout ( int  timeout_ms)
void webdriver::Session::set_current_frame ( const FramePath frame)
void webdriver::Session::set_current_view ( const ViewId viewId)
void webdriver::Session::set_implicit_wait ( int  timeout_ms)
void webdriver::Session::set_mouse_position ( const Point point)
void webdriver::Session::set_page_load_timeout ( int  timeout_ms)
void webdriver::Session::set_sticky_modifiers ( int  mods)
inline
const FilePath& webdriver::Session::temp_dir ( ) const
void webdriver::Session::Terminate ( )

Terminates this session and deletes itself.

void webdriver::Session::UpdateViews ( const std::set< ViewId > &  views)

Invalidate all views except passed

Parameters
viewsset of valid views

Member Data Documentation

std::vector<ElementId> webdriver::Session::frame_elements_

The documentation for this class was generated from the following file: