Sometimes the code run too fast and sometimes my website doesnt finish to refresh itself therefore the code failes #2153
-
I have a code for example: self.send_keys(fn.FieldsNames.id_html, final_id_pick) and my website when it puts the id in his box, it needs to "refresh" itself and update the id box accordingly, this takes something between to 1 second to 5 seconds. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When you're not sure what else you need to wait on, that's when you may be forced to use |
Beta Was this translation helpful? Give feedback.
self.wait_for_element_clickable()
waits forelement.is_displayed()
andelement.is_enabled()
(from the raw selenium built-in methods). It's not necessarily enough, depending on what you're actually clicking on, for the website you're using. You may need to wait for another element to be visible (for example) or something else. (Eg.self.wait_for_element_visible(selector)
)When you're not sure what else you need to wait on, that's when you may be forced to use
time.sleep(seconds)
/self.sleep(seconds)
in the meantime until you know exactly what you need to wait for.