Update chrome.js

This commit is contained in:
Namhyeon Go 2022-02-10 11:16:12 +09:00
parent 1ed11ef92c
commit e7b8aee6ab

View File

@ -1007,7 +1007,7 @@ var ChromeObject = function(interfaces) {
} }
} }
}; };
this.triggerEventByFind = function(eventName, selector, searchText) { this.triggerEventByFind = function(eventName, selector, searchText) {
var s = '(function() {' var s = '(function() {'
+ ' var element = Object.values(__getDocument().querySelectorAll("' + selector + '")).find(function(x) {' + ' var element = Object.values(__getDocument().querySelectorAll("' + selector + '")).find(function(x) {'
@ -1068,6 +1068,10 @@ var ChromeObject = function(interfaces) {
return this.getEvaluatedValue('__getDocument().querySelector("' + selector + '").getAttribute("' + attributeName + '")'); return this.getEvaluatedValue('__getDocument().querySelector("' + selector + '").getAttribute("' + attributeName + '")');
}; };
this.sendKeys = function(s) {
AutoIt.callFunction("Send", [s]);
};
this.sendSpaceKey = function() { this.sendSpaceKey = function() {
AutoIt.callFunction("Send", ["{SPACE}"]); AutoIt.callFunction("Send", ["{SPACE}"]);
}; };
@ -1088,7 +1092,7 @@ var ChromeObject = function(interfaces) {
i++; i++;
} }
}; };
this.getText = function(selector) { this.getText = function(selector) {
return this.getEvaluatedValue('__getDocument().querySelector("' + selector + '").innerText'); return this.getEvaluatedValue('__getDocument().querySelector("' + selector + '").innerText');
}; };
@ -1157,6 +1161,11 @@ var ChromeObject = function(interfaces) {
return this; return this;
}; };
this.mouseClick = function(x, y) {
AutoIt.callFunction("MouseMove", [x, y]);
AutoIt.callFunction("MouseClick", ["left"]);
};
this.create(); this.create();
}; };
ChromeObject.prototype = new STD.EventableObject(); ChromeObject.prototype = new STD.EventableObject();