1

I need to translate Selenium code into Playwright.

code:

self.wait_for_element_not_present("element CSS here")

Is the solution:

Not self.page.locator("element CSS here").is_visible()

1 Answer 1

3

You can use the not_be_visible expect assertion for this.

expect('element CSS here').not_to_be_visible()

By default expect assertions have a 5 second timeout, in case you want to increase the timeout, you can do like this:

expect('element CSS here').not_to_be_visible(timeout=7000)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.