Skip to main content

Text

getText

Check if a text content is visible on the page, identified by the string.

await getText(page, <TEXT CONTENT>)
tip

Make sure the string / number you add is exact (including correct case) otherwise this test will fail.

Use getTextPartialMatch for a more leniant selector

import { getText } from "foreplaywright";

export async function layoutCheck(page) {
await getText(page, "Text content to check");
}

getTextPartialMatch

Check if text content is visible on the page, identified by the text content itself.

Your string doesn't have to be exact

await getText(page, <TEXT CONTENT>)
tip

Your parameter does not have to be a full string, or captialised correctly

import { getTextPartialMatch } from "foreplaywright";

export async function layoutCheck(page) {
await getTextPartialMatch(page, "Text content tO Ch");
}

clickText

Click a piece of text that is visible on the page, identified by the text content.

await clickText(page, <TEXT CONTENT>)

Not only click the text but auto wait for the load to complete.

This means the test will wait until the page is ready for the next action.

tip

Make sure the string / number you add is exact (including correct case) otherwise this test will fail.

Use clickTextPartialMatch for a more leniant selector

import { clickText } from "foreplaywright";

export async function layoutCheck(page) {
await clickText(page, "Text Content to CLick");
}

clickTextPartialMatch

Click a piece of text that is visible on the page, identified by the text content.

await clickTextPartialMatch(page, <TEXT CONTENT>)

Not only click the text but auto wait for the load to complete.

This means the test will wait until the page is ready for the next action.

tip

Your parameter does not have to be a full string, or captialised correctly

import { clickTextPartialMatch } from "foreplaywright";

export async function layoutCheck(page) {
await clickTextPartialMatch(page, "text conten");
}

hoverText

Hover on a piece of text that is visible on the page, identified by the text content.

await hoverText(page, <TEXT CONTENT>)
tip

Make sure the string / number you add is exact (including correct case) otherwise this test will fail.

Use hoverTextPartialMatch for a more leniant selector

import { hoverText } from "foreplaywright";

export async function layoutCheck(page) {
await hoverText(page, "Text Content to Hover");
}

hoverTextPartialMatch

Hover on a piece of text that is visible on the page, identified by the text content.

await hoverTextPartialMatch(page, <TEXT CONTENT>)
tip

Your parameter does not have to be a full string, or captialised correctly

import { hoverTextPartialMatch } from "foreplaywright";

export async function layoutCheck(page) {
await hoverTextPartialMatch(page, "text conten");
}

scrollToText

Scroll the page til this text is within the viewport.

await scrollToText(page, <TEXT CONTENT>)
tip

Make sure the string / number you add is exact (including correct case) otherwise this test will fail.

Use scrollToTextPartialMatch for a more leniant selector

import { scrollToText } from "foreplaywright";

export async function layoutCheck(page) {
await scrollToText(page, "Text Content to Scroll To");
}

scrollToTextPartialMatch

Scroll the page til this text is within the viewport.

await scrollToTextPartialMatch(page, <TEXT CONTENT>)
tip

Your parameter does not have to be a full string, or captialised correctly

import { scrollToTextPartialMatch } from "foreplaywright";

export async function layoutCheck(page) {
await scrollToTextPartialMatch(page, "t to Scroll To");
}