unit testing - How to wait and get value of Span object in Selenium Python binding -
i have following code in web page.
<div id="" class="user_acc_setails"> <ul id="accdtlul"> <li>first name: <span id="f_name">anuja</span></li>
by time page loading, value sapn not set. take small time set value. want wait , value in python file.
i'm using following code,
element = context.browser.find_element_by_id('f_name') assert element.text == 'anuja'
but gives me assetionerror. how can solve this?
thanks
correct way case use explicit waits (see python code there). need like
from selenium.webdriver.support import expected_conditions ec wait = webdriverwait(driver, 10) element = wait.until(ec.text_to_be_present_in_element((by.id,'f_name'), 'anuja'))
Comments
Post a Comment