lib/capybara/poltergeist/client/compiled/browser.js in poltergeist-1.4.1 vs lib/capybara/poltergeist/client/compiled/browser.js in poltergeist-1.5.0
- old
+ new
@@ -151,10 +151,14 @@
Browser.prototype.visible_text = function(page_id, id) {
return this.sendResponse(this.node(page_id, id).visibleText());
};
+ Browser.prototype.delete_text = function(page_id, id) {
+ return this.sendResponse(this.node(page_id, id).deleteText());
+ };
+
Browser.prototype.attribute = function(page_id, id, name) {
return this.sendResponse(this.node(page_id, id).getAttribute(name));
};
Browser.prototype.value = function(page_id, id) {
@@ -322,10 +326,21 @@
top: top
});
return this.sendResponse(true);
};
+ Browser.prototype.send_keys = function(page_id, id, keys) {
+ var key, sequence, _i, _len;
+ this.node(page_id, id).mouseEvent('click');
+ for (_i = 0, _len = keys.length; _i < _len; _i++) {
+ sequence = keys[_i];
+ key = sequence.key != null ? this.page["native"].event.key[sequence.key] : sequence;
+ this.page.sendEvent('keypress', key);
+ }
+ return this.sendResponse(true);
+ };
+
Browser.prototype.render_base64 = function(format, full, selector) {
var encoded_image;
if (selector == null) {
selector = null;
}
@@ -369,10 +384,15 @@
};
this.page.setClipRect(rect);
return dimensions;
};
+ Browser.prototype.set_paper_size = function(size) {
+ this.page.setPaperSize(size);
+ return this.sendResponse(true);
+ };
+
Browser.prototype.resize = function(width, height) {
this.page.setViewportSize({
width: width,
height: height
});
@@ -381,10 +401,15 @@
Browser.prototype.network_traffic = function() {
return this.sendResponse(this.page.networkTraffic());
};
+ Browser.prototype.clear_network_traffic = function() {
+ this.page.clearNetworkTraffic();
+ return this.sendResponse(true);
+ };
+
Browser.prototype.get_headers = function() {
return this.sendResponse(this.page.getCustomHeaders());
};
Browser.prototype.set_headers = function(headers) {
@@ -433,10 +458,15 @@
Browser.prototype.cookies_enabled = function(flag) {
phantom.cookiesEnabled = flag;
return this.sendResponse(true);
};
+ Browser.prototype.set_http_auth = function(user, password) {
+ this.page.setHttpAuth(user, password);
+ return this.sendResponse(true);
+ };
+
Browser.prototype.set_js_errors = function(value) {
this.js_errors = value;
return this.sendResponse(true);
};
@@ -451,9 +481,23 @@
Browser.prototype.noop = function() {};
Browser.prototype.browser_error = function() {
throw new Error('zomg');
+ };
+
+ Browser.prototype.go_back = function() {
+ if (this.page.canGoBack) {
+ this.page.goBack();
+ }
+ return this.sendResponse(true);
+ };
+
+ Browser.prototype.go_forward = function() {
+ if (this.page.canGoForward) {
+ this.page.goForward();
+ }
+ return this.sendResponse(true);
};
return Browser;
})();