1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/src/Node.cpp

25 lines
746 B
C++
Raw Normal View History

#include "Node.h"
#include "WebPage.h"
#include "WebPageManager.h"
2013-01-20 18:57:04 -05:00
#include "InvocationResult.h"
Node::Node(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
}
void Node::start() {
QStringList functionArguments(arguments());
QString functionName = functionArguments.takeFirst();
2013-01-20 18:57:04 -05:00
InvocationResult result = page()->invokeCapybaraFunction(functionName, functionArguments);
if (result.hasError())
2013-02-11 18:31:41 -05:00
return finish(false, result.errorMessage());
2013-01-20 18:57:04 -05:00
QString attributeValue = result.result().toString();
2013-02-11 18:31:41 -05:00
finish(true, attributeValue);
}
QString Node::toString() const {
QStringList functionArguments(arguments());
return QString("Node.") + functionArguments.takeFirst();
}