Skip to content

Commit 56b4f35

Browse files
committed
Guard clausing visibility checks for playwright
1 parent 6f0fa1d commit 56b4f35

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wordpress-official-starter/playwright-flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def log_note(message: str) -> None:
2626
log_note('Home Page')
2727
page.goto("http://gcb-wordpress:9875", wait_until="networkidle")
2828

29-
# Wait until logo is visible
30-
page.locator('p#logo').wait_for(state="visible", timeout=30)
3129

30+
if not page.locator('p#logo').is_visible():
31+
page.locator('p#logo').wait_for(state="visible", timeout=30) # if we call this directly it can error if element is already visible. very annoying
3232

3333
# Example of navigating to another page:
3434
# page.goto("http://gcb-wordpress:9875/my-sample-page", wait_until="networkidle")

0 commit comments

Comments
 (0)