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