In my angular application, I utilize custom html attributes ("data-testid='saveButton'
") to identify elements such as buttons and inputs. Protractor does not have a built-in locator for this specific attribute, making it tricky to locate elements using XPath since it always searches from the document root. Creating an XPath string with various manipulations seemed too convoluted, so I abandoned that approach.
To address this issue, I decided to create my own locator and referenced the official Protractor Documentation.
However, the documentation raised a crucial question in my mind: What methods are accessible on the parent element object? The example demonstrates the usage of
using.querySelectorAll('button');
, but how was this method determined?
Upon searching for 'querySelectorAll' in the Protractor documentation, I could not find any indication that it is a method of either ElementFinder
or WebElement
.
Furthermore, I encountered difficulties in debugging the locator (aside from pausing the Protractor test with browser.pause()
), hindering my ability to explore runtime possibilities with the given parent element.
If anyone has insights on how I can gather information about available methods of the parent element, please share your knowledge!