getText
Get the text content from a DOM-element found by given selector. Make sure the element you want to request the text from is interactable otherwise you will get an empty string as return value. If the element is disabled or not visible and you still want to receive the text content use getHTML as a workaround.
Usage
1 | browser.getText(selector); |
Parameters
Param | Type | Details |
---|---|---|
selector | String | element with requested text |
Example
1 | <div id="elem"> |
1 | it('should get text of an element or elements', function () { |
Returns
- <String/String[]>: content of selected element (all HTML tags are removed)