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.

selectByAttribute.js 757B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const utils_1 = require("../../utils");
  4. async function selectByAttribute(attribute, value) {
  5. value = typeof value === 'number'
  6. ? value.toString()
  7. : value;
  8. const normalized = `[normalize-space(@${attribute.trim()}) = "${value.trim()}"]`;
  9. const optionElement = await this.findElementFromElement(this.elementId, 'xpath', `./option${normalized}|./optgroup/option${normalized}`);
  10. if (optionElement && optionElement.error === 'no such element') {
  11. throw new Error(`Option with attribute "${attribute}=${value}" not found.`);
  12. }
  13. return this.elementClick(utils_1.getElementFromResponse(optionElement));
  14. }
  15. exports.default = selectByAttribute;