splinter icon indicating copy to clipboard operation
splinter copied to clipboard

Wait for an element and its text

Open reezer opened this issue 13 years ago • 1 comments

For my use case I need to wait for a certain element (loaded via AJAX as a template) to appear and inside that element for a certain text to appear (that text is also visible elsewhere on the page). So basically I need something like this to test my application:

world.browser.find_by_id('user').is_text_present('Tom', 5)

Currently I have the problem that the next steps will be done too quickly.

reezer avatar Sep 26 '12 18:09 reezer

Hi,

@reezer - My understanding is you can just use an if loop, and it will implicitly wait until that element is present?

https://groups.google.com/d/topic/splinter-users/VKjw7ez9yS0/discussion

if browser.is_element_present_by_name('payment_type', WAIT_TIME):
        browser.select('payment_type', '.paywithcc, .buy_now_button')

Although to be honest, I've had intermittent issues with the above - would love to get confirmation from the devs that this is the way we're meant to be using it?

Cheers, Victor

victorhooi avatar Jan 14 '14 23:01 victorhooi