window.onload = function() {
var automator = new PageAutomator();
// Mouse events
automator.hover("#some-element");
automator.click("#some-element", "left");
automator.click("#some-element", "right");
automator.scroll(200);
automator.hold("#some-element", "left");
automator.hold("#some-element", "right");
automator.moveToPosition(200, 200);
automator.moveToElement("#some-element");
var position = automator.getPosition();
console.log(position);
// Keyboard events
automator.keyPress("a");
automator.keyUp("a");
automator.keyDown("a");
automator.holdKey("a");
automator.setKeyState("numlock", true);
// Block input
automator.blockInput();
// Timer events
automator.wait(1000);
automator.waitForElement("#some-element");
automator.waitForMouse("pointer");
// Conditionals
if (automator.ifElement("#some-element", "contains", "text")) {
console.log("element contains the specified text");
}
// Dialogs and message boxes
automator.showNotification("This is a notification");
automator.showDialog("This is a dialog");
automator.showCustomDialog("<p>This is a custom dialog</p>");
// Clipboard
var clipboardText = automator.getClipboardText();
console.log(clipboardText);
automator.setClipboardText("text to set to clipboard");
automator.clearClipboard();
}