filmov
tv
Selenium with Java 35 - Synchronization using Implicit wait and Thread.sleep method explained

Показать описание
Synchronization
Implicit Wait
What is synchronization?
Process of matching automation tool speed with application tool speed is called synchronization.
Whenever Webdriver try to perform action on the element is not loaded in UI or application, in such cases Webdriver throws ‘No such element exception’ and stops the execution because of the synchronization issue.
What is Thread Sleep method?
Thread Wait causes the currently executing thread to sleep for the specified number of milliseconds.
It always waits for specified amount of time, even though element is available early.
It is also called hard coded wait.
Implicit Wait commands :
On implementing implicit wait, if WebDriver cannot find an element in the Document Object Model(DOM), it will wait for a defined amount of time for the element to appear in the DOM
Driver will look for the element by polling every 500 milli second
Driver will wait specified amount time or element is available in the DOM
If the element is not available even after the specified time, driver will throw ElementNotFound exception
Possible Interview Questions on selenium synchronization :
What is Synchronization .
What is implicit wait
Code:
@Test
public void SynchronizationUsingThreadWait() throws InterruptedException
{
WebDriver driver = new FirefoxDriver();
}
@Test
public void SynchronizationUsingImplicitWait()
{
WebDriver driver = new FirefoxDriver();
}