Selenium with Java 36 - Synchronization using Explicit Wait and Expected conditions class methods

preview_player
Показать описание
Synchronization in selenium using Explicit Wait and Expected conditions class methods :

Synchronization in selenium using Explicit wait and Expected Conditions class.

Explicit Waits
WebDriverWait class
Expected conditions class

What is Explicit Wait?
An explicit wait can only be implemented in cases where synchronization is needed for an element and the rest of the script is working fine.
Explicit wait can be used to verify the page title, page url or to find the element.
The Selenium WebDriver provides WebDriverWait and ExpectedCondition classes for implementing an explicit wait.
The WebDriverWait object will call the ExpectedConditions class method for every 500 milliseconds until it returns successfully or specified time is over.
Usage:

Selenium Expected Condition class methods :
Supplies a set of common conditions that can be waited
All methods in this class are static
Some of the methods are overloaded methods
We can write custom Expected conditions method
Explicit waits are called intelligent waits as they are having various conditions

alertIsPresent
alertState
elementExists
elementIsVisible
elementSelectionStateToBe
elementToBeClickable
elementToBeSelected
frameToBeAvailableAndSwitchToIt
invisibilityOfElementLocated
invisibilityOfElementWithText
presenceOfAllElementsLocatedBy
stalenessOf
textToBePresentInElement
textToBePresentInElementLocated
textToBePresentInElementValue
titleContains
titleIs
urlContains
UrlToBe
visibilityOfAllElementsLocatedBy

Possible Interview Questions on selenium explicit wait and expected conditions :
What is explicitWait .
Which are the different methods present in Expected Condition class .

@Test
public void SynchronizationUsingExplicitWait()
{
WebDriver driver = new FirefoxDriver();
//driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(12));
//Thread.Sleep(12000);
WebDriverWait wait = new WebDriverWait(driver, 20);
//wait.PollingInterval = TimeSpan.FromMilliseconds(50);

}
Рекомендации по теме
Комментарии
Автор

Thank you for the above video . Could you also create a video with all the expected conditions in the ExpectedConditions Method.
It would be more helpful .

sureshbagi