vendredi 12 août 2016

How to make typescript not crying about compile error when adding custom locator

I have written a custom locator:

onPrepare: function() {
  browser.ignoreSynchronization = true;
  by.addLocator('automationId', function(value, parentElement) {
    parentElement = parentElement || document;
     var nodes = parentElement.querySelectorAll('[automationId]');
     return Array.prototype.filter.call(nodes, function(node) {
       return (node.getAttribute('automationId') === value);
     });
  });
},

but when I try to use it and run, I get compile errors:

element.by(automationId('auto-id'));

the error is:

Property automationId does not exist on type IProtractorLocationStrategy

How to fix this?

Aucun commentaire:

Enregistrer un commentaire