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

#include <command.h>

Inheritance diagram for webdriver::Command:
Collaboration diagram for webdriver::Command:

Public Member Functions

 Command (const std::vector< std::string > &path_segments, const DictionaryValue *const parameters)
 
 Command (const Command &other)
 
virtual ~Command ()
 
virtual bool DoesDelete () const
 
virtual bool DoesGet () const
 
virtual bool DoesPost () const
 
virtual bool Init (Response *const response)
 
virtual void Finish (Response *const response)
 
virtual void ExecuteDelete (Response *const response)
 
virtual void ExecuteGet (Response *const response)
 
virtual void ExecutePost (Response *const response)
 

Protected Member Functions

std::string GetPathVariable (const size_t i) const
 
bool HasParameter (const std::string &key) const
 
bool IsNullParameter (const std::string &key) const
 
bool GetStringParameter (const std::string &key, string16 *out) const
 
bool GetStringParameter (const std::string &key, std::string *out) const
 
bool GetStringASCIIParameter (const std::string &key, std::string *out) const
 
bool GetBooleanParameter (const std::string &key, bool *out) const
 
bool GetIntegerParameter (const std::string &key, int *out) const
 
bool GetDoubleParameter (const std::string &key, double *out) const
 
bool GetDictionaryParameter (const std::string &key, const DictionaryValue **out) const
 
bool GetListParameter (const std::string &key, const ListValue **out) const
 

Protected Attributes

const std::vector< std::string > path_segments_
 
yasper::ptr< const
DictionaryValue > 
parameters_
 

Detailed Description

Base class for a command mapped to a URL in the WebDriver REST API. Each URL may respond to commands sent with a DELETE, GET/HEAD, or POST HTTP request. For more information on the WebDriver REST API, see http://code.google.com/p/selenium/wiki/JsonWireProtocol

Constructor & Destructor Documentation

webdriver::Command::Command ( const std::vector< std::string > &  path_segments,
const DictionaryValue *const  parameters 
)

base constructor

Parameters
path_segmentsvector of segments of path of url
parameterscontainer of parsed JSON input
webdriver::Command::Command ( const Command other)
virtual webdriver::Command::~Command ( )
virtual

Member Function Documentation

virtual bool webdriver::Command::DoesDelete ( ) const
virtual
virtual bool webdriver::Command::DoesGet ( ) const
virtual
virtual void webdriver::Command::ExecuteDelete ( Response *const  response)
inlinevirtual

Executes the corresponding variant of this command URL. Always called after Init() and called from the Execute function. Any failure is handled as a return code found in Response.

Parameters
responsepointer to response object

Reimplemented in webdriver::SessionStorageKeyCommand, webdriver::SessionStorageCommand, webdriver::WindowCommand, webdriver::NamedCookieCommand, webdriver::LocalStorageKeyCommand, webdriver::LocalStorageCommand, webdriver::CookieCommand, and webdriver::SessionWithID.

virtual void webdriver::Command::ExecuteGet ( Response *const  response)
inlinevirtual

Executes the corresponding variant of this command URL. Always called after Init() and called from the Execute function. Any failure is handled as a return code found in Response.

Parameters
responsepointer to response object

Reimplemented in webdriver::ElementScreenshotCommand, webdriver::ElementTextCommand, webdriver::ElementSizeCommand, webdriver::ElementSelectedCommand, webdriver::ElementNameCommand, webdriver::ElementLocationInViewCommand, webdriver::ElementLocationCommand, webdriver::ElementEqualsCommand, webdriver::SessionStorageSizeCommand, webdriver::ElementEnabledCommand, webdriver::SessionStorageKeyCommand, webdriver::ElementDisplayedCommand, webdriver::CISCO_PlaybackSpeedCommand, webdriver::SessionStorageCommand, webdriver::ElementCssCommand, webdriver::CISCO_MuteCommand, webdriver::LocalStorageSizeCommand, webdriver::CISCO_SeekCommand, webdriver::ElementAttributeCommand, webdriver::LocalStorageKeyCommand, webdriver::VisualizerShowPointCommand, webdriver::URLCommand, webdriver::CISCO_StateCommand, webdriver::GlobalLogCommand, webdriver::WindowHandlesCommand, webdriver::WindowPositionCommand, webdriver::LogTypesCommand, webdriver::VisualizerSourceCommand, webdriver::Sessions, webdriver::CookieCommand, webdriver::SessionWithID, webdriver::OrientationCommand, webdriver::LocalStorageCommand, webdriver::StatusCommand, webdriver::WindowHandleCommand, webdriver::CISCO_VolumeCommand, webdriver::HTML5LocationCommand, webdriver::AlertTextCommand, webdriver::AppCacheStatusCommand, webdriver::ScreenshotCommand, webdriver::SourceCommand, webdriver::WindowSizeCommand, webdriver::TitleCommand, and webdriver::BrowserConnectionCommand.

virtual void webdriver::Command::ExecutePost ( Response *const  response)
inlinevirtual

Executes the corresponding variant of this command URL. Always called after Init() and called from the Execute function. Any failure is handled as a return code found in Response.

Parameters
responsepointer to response object

Reimplemented in webdriver::ElementValueCommand, webdriver::ElementSubmitCommand, webdriver::ElementSelectedCommand, webdriver::TouchPinchZoomCommand, webdriver::WheelCommand, webdriver::TouchPinchRotateCommand, webdriver::DoubleClickCommand, webdriver::TouchFlickCommand, webdriver::ButtonUpCommand, webdriver::TouchLongClickCommand, webdriver::TouchScrollCommand, webdriver::ButtonDownCommand, webdriver::TouchMoveCommand, webdriver::ClickCommand, webdriver::ActiveElementCommand, webdriver::TouchDoubleClickCommand, webdriver::CISCO_PlaybackSpeedCommand, webdriver::SessionStorageCommand, webdriver::SwitchFrameCommand, webdriver::TouchUpCommand, webdriver::MoveToCommand, webdriver::CISCO_MuteCommand, webdriver::TouchDownCommand, webdriver::ElementClearCommand, webdriver::CISCO_SeekCommand, webdriver::WindowCommand, webdriver::WindowMaximizeCommand, webdriver::DismissAlertCommand, webdriver::TouchClickCommand, webdriver::RefreshCommand, webdriver::URLCommand, webdriver::CISCO_StateCommand, webdriver::HoverCommand, webdriver::WindowPositionCommand, webdriver::AcceptAlertCommand, webdriver::BackCommand, webdriver::XDRPCCommand, webdriver::CookieCommand, webdriver::LocalStorageCommand, webdriver::CreateSession, webdriver::HTML5LocationCommand, webdriver::OrientationCommand, webdriver::SetTimeoutCommand, webdriver::ExecuteAsyncScriptCommand, webdriver::CISCO_VolumeCommand, webdriver::AlertTextCommand, webdriver::MoveAndClickCommand, webdriver::ExecuteCommand, webdriver::KeysCommand, webdriver::WindowSizeCommand, webdriver::LogCommand, webdriver::FindElementCommand, webdriver::ForwardCommand, and webdriver::BrowserConnectionCommand.

virtual void webdriver::Command::Finish ( Response *const  response)
virtual

Called after this command is executed. This is only called if Init() is successful and regardless of whether the execution results in a Error.

Parameters
responsepointer to response object

Reimplemented in webdriver::WebDriverCommand.

bool webdriver::Command::GetBooleanParameter ( const std::string &  key,
bool *  out 
) const
protected

Provides the command parameter with the given |key| as a boolean. Returns false if there is no such parameter, or if it is not a boolean.

bool webdriver::Command::GetDictionaryParameter ( const std::string &  key,
const DictionaryValue **  out 
) const
protected

Provides the command parameter with the given |key| as a Dictionary. Returns false if there is no such parameter, or if it is not a Dictionary.

bool webdriver::Command::GetDoubleParameter ( const std::string &  key,
double *  out 
) const
protected

Provides the command parameter with the given |key| as a double. Returns false if there is no such parameter, or if it is not a dobule.

bool webdriver::Command::GetIntegerParameter ( const std::string &  key,
int *  out 
) const
protected

Provides the command parameter with the given |key| as a int. Returns false if there is no such parameter, or if it is not a int.

bool webdriver::Command::GetListParameter ( const std::string &  key,
const ListValue **  out 
) const
protected

Provides the command parameter with the given |key| as a list. Returns false if there is no such parameter, or if it is not a list.

std::string webdriver::Command::GetPathVariable ( const size_t  i) const
protected

Returns the path variable encoded at the |i|th index (0-based) in the request URL for this command. If the index is out of bounds, an empty string will be returned.

bool webdriver::Command::GetStringASCIIParameter ( const std::string &  key,
std::string *  out 
) const
protected

Provides the command parameter with the given |key| as a ASCII string. Returns true on success.

bool webdriver::Command::GetStringParameter ( const std::string &  key,
string16 *  out 
) const
protected

Returns the command parameter with the given |key| as a UTF-16 string. Returns true on success.

bool webdriver::Command::GetStringParameter ( const std::string &  key,
std::string *  out 
) const
protected

Provides the command parameter with the given |key| as a UTF-8 string. Returns true on success.

bool webdriver::Command::HasParameter ( const std::string &  key) const
protected

Returns whether the command has a parameter with the given |key|.

virtual bool webdriver::Command::Init ( Response *const  response)
virtual

Initializes this command for execution. If initialization fails, will return false and populate the response with the necessary information to return to the client.

Parameters
responsepointer to response object
Returns
true - if method succeed

Reimplemented in webdriver::WheelCommand, webdriver::ClickCommand, webdriver::MoveToCommand, webdriver::ViewCommand, webdriver::NamedCookieCommand, webdriver::WebDriverCommand, and webdriver::ElementCommand.

bool webdriver::Command::IsNullParameter ( const std::string &  key) const
protected

Returns true if the command parameter with the given |key| exists and is a null value.

Member Data Documentation

yasper::ptr<const DictionaryValue> webdriver::Command::parameters_
protected
const std::vector<std::string> webdriver::Command::path_segments_
protected

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