Lets learn together =====Synchronization in Selenium========
What is Synchronization ?
Why we need Synchronization ?
How to implement it using Selenium WebDriver ?
---------------------------------------------------------------
Static and Dynamic Waits
--------------------------------------------------------------
How to achieve Synchronization in Selenium:
1. Implicit Wait : Dynamic Wait
driver can you please wait for max 10 sec to find element. Then gives exception "NoSuchElementException"
Ignore the rest time remaining and start executing next sentence.
Applied globally
Applicable for driver.findElement and driver.findElements
Syntax for Implicit wait:
driver.manage().timeouts().implicitlyWait(5000, TimeUnit.miliSECONDS);
--------------------------------------------------------------
2.Explicit Wait: Dynamic Wait
Can not be applied globally.
Specific WebElement.
Syntax for Explicit wait:
WebDriverWait wait=new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("checkbox")));
------------------------------------------------------
The following Expected Conditions can be used in Explicit Wait.
alertIsPresent()
elementSelectionStateToBe()
elementToBeClickable()
elementToBeSelected()
frameToBeAvaliableAndSwitchToIt()
invisibilityOfTheElementLocated()
invisibilityOfElementWithText()
presenceOfAllElementsLocatedBy()
presenceOfElementLocated()
textToBePresentInElement()
textToBePresentInElementLocated()
textToBePresentInElementValue()
titleIs()
titleContains()
visibilityOf()
visibilityOfAllElements()
visibilityOfAllElementsLocatedBy()
visibilityOfElementLocated()
-----------------------------------------------------------
3. Fluent Wait: Dynamic wait
driver can you please wait for max 30 seconds and keep looking for the specific element at every 5 seconds interval(polling). Once you find that webelement within time then ignore the reaming time and perform action immediately.
Syntax for Fluent wait:
Wait WebDriver wait=new FluentWait WebDriver(driver)
.withTimeout(Duration.ofSeconds(30))
.pollingEvery(Duration.ofSeconds(30))
.ignoring(Exception.class)
WebElement clickcheckbox = wait.until(new Function WebDriver, WebElement(){
public WebElement apply(WebDriver driver ) {
return driver.findElement(By.id(""checkbox""));
}
});
-----------------------------------------------------------
Note: Both the WebDriverWait and FluentWait classes implements the Wait interface.
------------------------------------------------------------
4. Thread.sleep(10000); Static wait(It does not come under Selenium waits, its a java wait)
Please pause the code execution for 10 Seconds. Do nothing for 10 seconds and only after that execute next sentence.
==========================
******AJ AUTOMATION*****
==========================
Hi guys, Please share and Like the content whichever you find informative to reach more beginner candidates learning Test Automation. Thanks for your Support !!
==:Useful Playlists for learning Test Automation:==
✅ Let's Learn the Concept in 5 To 10 Mins :=
• Test Automation Interviews Preparation - L...
✅ Selenium series videos Playlist :=
• Selenium tutorial for beginners - Most Imp...
✅ Maven Tool videos playlist :=
• Maven Tool - Learn Basics To Advanced topi...
✅ Selenium WebDriver Exceptions Playlist :=
• Selenium WebDriver Exceptions
✅ Selenium Grid With Docker:==
• Selenium Grid With Docker - Learn To Setup...
✅ Upload and Download Files in Selenium :=
• Selenium WebDriver - Upload and Download f...
✅ Excel and CSV files operations :=
• Excel and CSV -- Read Write Operations
✅ Java Language Concepts :=
• Java Language Concepts - By AjAutomation
✅TestNG Framework Videos:=
• TestNG Introduction and Why we use TestNG ...
✅ Become Master in Xpath:=
• Xpath Introduction
✅ Protractor series videos playlist :=
• Let's Learn Protractor - By AjAutomation
✅ Recent Uploads :=
• Recent Uploaded Videos
✅ GitHub Repo:= https://github.com/ajautomation
⚡️ Thanks for your support !! ⚡️
======================================
*************** Thanks for watching !!*************
======================================
⚡️ Keep Learning...Keep Sharing...Keep Growing. ⚡️
#LearnSeleniumInEasyWay #SeleniumWebDriver
On this page of the site you can watch the video online Synchronization in Selenium || Implicit Wait || Explicit Wait || Fluent Wait || Waits in Selenium with a duration of hours minute second in good quality, which was uploaded by the user AJ AUTOMATION 01 January 1970, share the link with friends and acquaintances, this video has already been watched 1,722 times on youtube and it was liked by 24 viewers. Enjoy your viewing!