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.

refetchElement.js 1.1KB

12345678910111213141516171819202122
  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 implicitWait_1 = __importDefault(require("./implicitWait"));
  7. async function refetchElement(currentElement, commandName) {
  8. let selectors = [];
  9. while (currentElement.elementId && currentElement.parent) {
  10. selectors.push({ selector: currentElement.selector, index: currentElement.index || 0 });
  11. currentElement = currentElement.parent;
  12. }
  13. selectors.reverse();
  14. const length = selectors.length;
  15. return selectors.reduce(async (elementPromise, { selector, index }, currentIndex) => {
  16. const resolvedElement = await elementPromise;
  17. let nextElement = index > 0 ? (await resolvedElement.$$(selector))[index] : null;
  18. nextElement = nextElement || await resolvedElement.$(selector);
  19. return await implicitWait_1.default(nextElement, currentIndex + 1 < length ? '$' : commandName);
  20. }, Promise.resolve(currentElement));
  21. }
  22. exports.default = refetchElement;