jeudi 25 juin 2015

How to develop a custom protractor locator?

I have a angular-application where i put custom html-attributes ("data-testid='saveButton') for identification on e.g. buttons, inputs etc. Protractor has no built-in locator for that, the xpath-way does not work as this will always search from the document root (to overcome this limitation i would have to do quite a lot string-magic to build the xpath-string, so i discarded this variant).

So i wanted to write my own locator, and consultet the official documentation: http://ift.tt/1uQVwYa

But the documentation leaves me with an important question: What methods are available on the parent-element-object? In their example they use using.querySelectorAll('button'); but how do they now they can use this?

I searched for 'querySelectorAll' in the protractor-documentation to see if it is maybe an method of ElementFinder or WebElement, but i didn't find it.

Also i found no way to debug the locator (only stop the protractor-test by browser.pause()), so i can't look at runtime what i can do with the given parent-element.

So does anybody know how i can get the information what methods the parent-element has?

Aucun commentaire:

Enregistrer un commentaire