QA Wolf logo

QA Wolf

/

Star

2.8k

assertElement(page, selector[, options])

Assert element is on the page.

If the element is not found before the timeout, an error is thrown.

// assert the page has the element with selector "#my-element" within 30 seconds
await assertElement(page, "#my-element");
// assert the page has the element with selector ".submit" within 60 seconds
await assertElement(page, ".submit", { timeout: 60000 });

Arguments

page (Page): The page to search for text.

selector (string): Selector of element to assert exists.

[options] (Object)

  • [timeout] (number): Time in milliseconds to wait for the element. Default: 30000

Returns: Promise<void>