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.

selectByIndex.js 797B

1234567891011121314151617
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const utils_1 = require("../../utils");
  4. async function selectByIndex(index) {
  5. if (index < 0) {
  6. throw new Error('Index needs to be 0 or any other positive number');
  7. }
  8. const optionElements = await this.findElementsFromElement(this.elementId, 'css selector', 'option');
  9. if (optionElements.length === 0) {
  10. throw new Error('Select element doesn\'t contain any option element');
  11. }
  12. if (optionElements.length - 1 < index) {
  13. throw new Error(`Option with index "${index}" not found. Select element only contains ${optionElements.length} option elements`);
  14. }
  15. return this.elementClick(utils_1.getElementFromResponse(optionElements[index]));
  16. }
  17. exports.default = selectByIndex;