In this video, we will discuss about Different Waits in Selenium | Implicit vs Explicit vs Fluent waits vs Thread.sleep() vs pageLoadTimeOut.
1. Why do we need Waits in Selenium?
Waits are very much important in Selenium automation. Without Waits, our tests won't work as expected. There are several reasons for any exceptions related to the web element. It could be the delay in loading the elements or there may not be any element with the locator provided and so on. In all these conditions, wait enables us to perform our operations effectively without breaking the tests.
2. Wait options available for Selenium:
Thread.sleep(), Implicit wait, Explicit wait and Fluent wait
3. Why use Selenium Waits over thread.sleep()?
Thread.sleep() reduces the performance of the code to a greater extent and it's not recommended.
4. Pros and cons of Implicit Wait:
--------------------------------------------------------
a)We cannot mention any explicit condition to be met before performing any operation using Implicit Wait.
b) Implicit Wait, will not bother if the element is hidden or can be interacted. If the element is present in the DOM, it will immediately release the wait and will start performing the further operations which are not desirable at most of the situations.
c) Implicit Wait is applicable for all the web elements found using the web driver and implicit wait has power until driver.quit() is encountered.
d) We can't control the polling time-frequency using implicit wait.
5. Pros and cons of Explicit Wait:
--------------------------------------------------------
a)We can mention any (inbuilt conditions are plenty and that is more than enough for any web applications) explicit condition to be met before performing any operation.
b) Explicit wait performs very well when compared to implicit wait and is the widely used wait condition.
c) Explicit Wait is applicable for only the web elements found using the web driver wait and has no control over other elements found normally.
d) We can't control the polling time-frequency using Explicit wait. Same is the case with the implicit wait.
𝐓𝐡𝐞 𝐛𝐞𝐥𝐨𝐰 𝐰𝐞𝐛𝐬𝐢𝐭𝐞 𝐢𝐬 𝐮𝐬𝐞𝐝 𝐟𝐨𝐫 𝐩𝐫𝐚𝐜𝐭𝐢𝐜𝐞: 👇
✅ https://www.leafground.com/waits.xhtml
You can practice wait concept with below website As i mentiond in the
Video : 👇
✅ https://opensource-demo.orangehrmlive...
Topics Covered
-------------------------------
⬤ Thread.sleep
⬤ PageLoadTimout
⬤ Implicit Wait
⬤ Explicit Wait
⬤ Fluent Wait
Support by donating:
---------------------------------
Best way to reach me (replies will be faster): YouTube comment section
👤 Name : Hashir Hasmy
📱 LinkedIn : / mohamed-hashir-370840198
📧 Email : [email protected]
🔗 GitHub : https://github.com/hashirhasmy
#selenium #Java #SeleniumWaits #ImplicitWait #ExplicitWait #FluentWait #Sinhala #HashirHasmy #webAutomation #QualityAssurance