Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getActiveElement.js 1.1KB

123456789101112131415161718192021222324
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const findElement_1 = __importDefault(require("./findElement"));
  7. const getActiveElement_1 = __importDefault(require("../scripts/getActiveElement"));
  8. const cleanUpSerializationSelector_1 = __importDefault(require("../scripts/cleanUpSerializationSelector"));
  9. const constants_1 = require("../constants");
  10. async function getActiveElement() {
  11. const page = this.getPageHandle(true);
  12. const selector = `[${constants_1.SERIALIZE_PROPERTY}]`;
  13. const hasElem = await page.$eval('html', getActiveElement_1.default, constants_1.SERIALIZE_PROPERTY);
  14. if (!hasElem) {
  15. throw new Error('no element active');
  16. }
  17. const activeElement = await findElement_1.default.call(this, {
  18. using: 'css selector',
  19. value: selector
  20. });
  21. await page.$eval(selector, cleanUpSerializationSelector_1.default, constants_1.SERIALIZE_PROPERTY);
  22. return activeElement;
  23. }
  24. exports.default = getActiveElement;