class Playwright::Page
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
run(playwright)
with sync_playwright() as playwright:
browser.close()
print("Loaded image: " + str(element.get_attribute("src")))
element = page.wait_for_selector("img")
page.goto(current_url, wait_until="domcontentloaded")
for current_url in ["https://google.com", "https://bbc.com"]:
page = browser.new_page()
browser = chromium.launch()
chromium = playwright.chromium
def run(playwright: Playwright):
from playwright.sync_api import sync_playwright, Playwright
```python sync
This method works across navigations:
**Usage**
function will throw.
will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the
visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method
Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become
`Locator` objects and web-first assertions makes the code wait-for-selector-free.
**NOTE**: Playwright automatically waits for element to be ready before performing an action. Using
`detached`.
Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
def wait_for_selector(selector, state: nil, strict: nil, timeout: nil) wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout))) end