Commit c0d6ee10 c0d6ee10d7943373a593e82bb7c6d926d9fd4fe6 by Nicolas Perriault

restablished js-emulated click simulation first, then native QtWebKit events as …

…a fallback; some real world testing have surprinsingly proven the former being often more efficient than the latter
Subproject commit f07aa7f99c84bb0de1b67e4e967586fa16979b86
Subproject commit 96895e7d4b64bf4d5c4cb9d62197b7c834a1e4ce
......
......@@ -177,6 +177,7 @@ Casper.prototype.capture = function capture(targetFile, clipRect) {
if (!this.page.render(this.filter('capture.target_filename', targetFile) || targetFile)) {
this.log(f("Failed to save screenshot to %s; please check permissions", targetFile), "error");
} else {
this.log(f("Capture saved to %s", targetFile), "info");
this.emit('capture.saved', targetFile);
}
if (previousClipRect) {
......@@ -242,11 +243,20 @@ Casper.prototype.click = function click(selector, fallbackToHref) {
if (arguments.length > 1) {
this.emit("deprecated", "The click() method does not process the fallbackToHref argument since 0.6");
}
try {
this.mouse.click(selector);
} catch (e) {
this.log(f("Error while trying to click on selector %s: %s", selector, e));
return false;
if (!this.exists(selector)) {
throw new CasperError("Cannot click on unexistent selector: " + selector);
}
var clicked = this.evaluate(function(selector) {
__utils__.click(selector);
}, { selector: selector });
if (!clicked) {
// fallback onto native QtWebKit mouse events
try {
this.mouse.click(selector);
} catch (e) {
this.log(f("Error while trying to click on selector %s: %s", selector, e));
return false;
}
}
return true;
};
......