Skip to content

element.contains

element.contains(text: string): Promise<DOMElement>

Section titled “element.contains(text: string): Promise<DOMElement>”

Retrieves a DOM element containing the specified text starting from the current element.

  • text: The text to search for in the DOM element.
  • Returns a promise that resolves to DOMElement that contains the text.
describe('Test script', function () {
it('Test 1', async () => {
const element = await gf.get('.my-element');
const childElement = await element.contains('Hello, World!');
});
});