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.

implicitWait.js 1.8KB

12345678910111213141516171819202122232425262728293031
  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 logger_1 = __importDefault(require("@wdio/logger"));
  7. const log = logger_1.default('webdriverio');
  8. async function implicitWait(currentElement, commandName) {
  9. if (!currentElement.elementId && !commandName.match(/(waitUntil|waitFor|isExisting|is?\w+Displayed|is?\w+Clickable)/)) {
  10. log.debug(`command ${commandName} was called on an element ("${currentElement.selector}") ` +
  11. 'that wasn\'t found, waiting for it...');
  12. try {
  13. await currentElement.waitForExist();
  14. return await currentElement.parent.$(currentElement.selector);
  15. }
  16. catch (_a) {
  17. if (currentElement.selector.toString().includes('this.previousElementSibling')) {
  18. throw new Error(`Can't call ${commandName} on previous element of element with selector "${currentElement.parent.selector}" because sibling wasn't found`);
  19. }
  20. if (currentElement.selector.toString().includes('this.nextElementSibling')) {
  21. throw new Error(`Can't call ${commandName} on next element of element with selector "${currentElement.parent.selector}" because sibling wasn't found`);
  22. }
  23. if (currentElement.selector.toString().includes('this.parentElement')) {
  24. throw new Error(`Can't call ${commandName} on parent element of element with selector "${currentElement.parent.selector}" because it wasn't found`);
  25. }
  26. throw new Error(`Can't call ${commandName} on element with selector "${currentElement.selector}" because element wasn't found`);
  27. }
  28. }
  29. return currentElement;
  30. }
  31. exports.default = implicitWait;