capybara-webkit/src/Find.cpp

20 lines
475 B
C++
Raw Normal View History

2011-02-19 03:53:06 +00:00
#include "Find.h"
#include "Command.h"
#include "WebPage.h"
Find::Find(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
2011-02-19 03:53:06 +00:00
}
void Find::start() {
QString message;
QVariant result = page()->invokeCapybaraFunction("find", arguments());
2011-02-19 03:53:06 +00:00
if (result.isValid()) {
message = result.toString();
emit finished(new Response(true, message));
} else {
emit finished(new Response(false, "Invalid XPath expression"));
2011-02-19 03:53:06 +00:00
}
}