flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
54 lines • 2.08 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PuppeteerElement = void 0;
const domelement_1 = require("./domelement");
class PuppeteerElement extends domelement_1.DOMElement {
constructor(input, context, name, path) {
super(input, context, name, path);
}
get _page() {
if (this.context.page === null) {
throw "Puppeteer page object was not found.";
}
return this.context.page;
}
toString() {
return String(this.path);
}
clearThenType(textToType, opts = {}) {
return __awaiter(this, void 0, void 0, function* () {
yield this.clear();
yield this.type(textToType, opts);
});
}
eval(js) {
return __awaiter(this, void 0, void 0, function* () {
return this._eval(js);
});
}
_getSourceCode() {
return __awaiter(this, void 0, void 0, function* () {
this._sourceCode = yield this._getOuterHtml();
return this._sourceCode;
});
}
_eval(js, arg) {
return this._page.evaluate(js, arg);
}
_getProperty(key) {
return __awaiter(this, void 0, void 0, function* () {
return (yield this._input.getProperty(key)).jsonValue();
});
}
}
exports.PuppeteerElement = PuppeteerElement;
//# sourceMappingURL=puppeteerelement.js.map