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.

elementClick.js 1.2KB

12345678910111213141516171819202122232425262728
  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 getElementTagName_1 = __importDefault(require("./getElementTagName"));
  7. const selectOption_1 = __importDefault(require("../scripts/selectOption"));
  8. const utils_1 = require("../utils");
  9. async function elementClick({ elementId }) {
  10. const page = this.getPageHandle();
  11. const elementHandle = await this.elementStore.get(elementId);
  12. if (!elementHandle) {
  13. throw utils_1.getStaleElementError(elementId);
  14. }
  15. const tagName = await getElementTagName_1.default.call(this, { elementId });
  16. if (tagName === 'option') {
  17. return page.$eval('html', selectOption_1.default, elementHandle);
  18. }
  19. return new Promise((resolve, reject) => {
  20. const dialogHandler = () => resolve(null);
  21. page.once('dialog', dialogHandler);
  22. return elementHandle.click().then(() => {
  23. page.removeListener('dialog', dialogHandler);
  24. resolve(null);
  25. }).catch(reject);
  26. });
  27. }
  28. exports.default = elementClick;