Rayrun
← Back to Discord Forum

help any show text

page.locator("div").filter(has_text=re.compile(r"^Uploaded (100%)$"))

how to wait untill this locator showed? i upload video on twitter, and must wait until video upload to tweet

This thread is trying to answer question "How to wait until a specific locator is visible after uploading a video on Twitter?"

11 replies
tphillips8117

use assertions: https://playwright.dev/docs/api/class-locatorassertions await expect(page.locator("div").filter(has_text=re.compile(r"^Uploaded (100%)$"))).toBeVisible()

can make example with python?

raise AssertionError(f"{out_message}\nActual value: {actual} {log}") AssertionError: Locator expected to be visible Actual value: None Call log: LocatorAssertions.to_be_visible with timeout 5000ms waiting for locator("div").filter(has_text=re.compile(r"^Uploaded (100%)$"))

locator = page.locator("div").filter(has_text=re.compile(r"^Uploaded (100%)$")) expect(locator).to_be_visible()

how to fix

tphillips8117

How long does it usually take to upload?

depending on internet speed

tphillips8117

If it takes longer than 5 seconds, then you'll see the exception

tphillips8117

it's telling you it didn't find the locator within 5 seconds

tphillips8117

you can increase the timeout to have it wait longer

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].