This API will return a property when asked to retrieve the content of the value attribute. It will do this even when the value attribute is undefined!
This is wrong, because…
- An element property is not the same as an element attribute.
Note: Perhaps it always returns properties, I did not test that.
Because there is existing test code reliant on the current behavior, the documentation should make clear this API is deprecated in favor of two new APIs which do the correct thing:
getElementAttribute get the value of the specified attribute
setElementAttribute set the specified attribute.
A note should be added to the documentation for setElementAttribute that it will likely change the expected behavior of the DOM form.reset API (if used by the AUT).
setText and getText
Ideally, these two APIs would be the compliment of each other but sadly that is not the case.
setText sets the value property of an input element.
getText performs a trimmed innerText property retrieval which does not work at all with the value property of input elements.
Because there is existing code that relies on the current behavior, the documentation should make clear these APIs are deprecated in favor of new APIs which do the correct thing:
setElementValue sets the value property of an element.
getElementValue returns the value property of an element.
getElementInnerText returns the timmed innerText content of the element.
For completeness’ sake, perhaps there should be a generic setElementProperty, also (although I am not certain of its true need in everyday testing).
I thought long and hard about reporting these as “bugs” but in the end went with “suggestions”. Either way, Katalon Studio and its stable of related tools are supposed to help enable quality assurance in software - the least it could do is provide a meaningful and easily reasoned about set of APIs.