mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update chrome.js
This commit is contained in:
parent
ef7f6fb0e1
commit
512f0b4cb9
|
@ -1180,6 +1180,10 @@ var ChromeObject = function(interfaces) {
|
|||
this.prompt = function(s) {
|
||||
return this.getEvaluatedValue('prompt("' + s + '")');
|
||||
};
|
||||
|
||||
this.confirm = function(s) {
|
||||
return this.getEvaluatedValue('(confirm("' + s + '") ? "true" : "false")');
|
||||
};
|
||||
|
||||
this.setVendor = function(vendor) {
|
||||
var vendor = vendor.toLowerCase();
|
||||
|
@ -1225,6 +1229,18 @@ var ChromeObject = function(interfaces) {
|
|||
return this.getEvaluatedValue("document.cookie");
|
||||
};
|
||||
|
||||
this.getNumberOfSelectorAll = function(selector) {
|
||||
return parseInt(this.getEvaluatedValue('document.querySelectorAll("' + selector + '").length'));
|
||||
};
|
||||
|
||||
this.setValueOfInputs = function(type, s) {
|
||||
this.evaluate('document.querySelectorAll("[type=' + type + ']").forEach(function(x){x.value = "' + s + '";})');
|
||||
};
|
||||
|
||||
this.sendEnterKey = function() {
|
||||
this.evaluate('var ev=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,keyCode:13});document.body.dispatchEvent(ev);');
|
||||
};
|
||||
|
||||
this.create();
|
||||
};
|
||||
ChromeObject.prototype = new STD.EventableObject();
|
||||
|
|
Loading…
Reference in New Issue
Block a user