There’re several ways of finding an element that matches a part or the whole of text:

Using page.get_by_text():

page.get_by_text("Welcome, Zoey")

Using page.locator():

page.locator('text=Welcome, Zoey')

XPath alternative:

page.locator("xpath=//*[contains(text(),'Welcome, Zoey')]")