You are on page 1of 2

1.

SYNCHRONIZATION HANDLING
 The automation script speed is very high compare to web application.
 To make the proper automation script we have to manage both application speed, this
process is called as synchronization.
 If the synchronization is not proper then we will get no such element exception.
 There are 4 ways to handle synchronization.
o Thread.sleep() - Java Wait
o Implicit Wait -- Selenium
o Explicit Wait -- Selenium
o Fluent Wait - Selenium
 Thread.sleep() - Java Wait
o It is coming from java and it is also called as dead wait.
o It will wait exact time which we provided inside this.
 limitation
o it makes the test script lengthier.
o It makes the performance of test script slow.
 IMPLICIT WAIT- SELENIUM
Webpage

User name Webpage <input id = “username”>

Driver.findElement(By.id (“username”));

{Implicit wait will wait up to the username is


loaded in the webpage.}

o Implicit wait will wait up to the particular web Element to be loaded in the web
page. Once that element is loaded then it will go to the next line.
o SYNTAX
o Options opt = driver.manage();
o Timeouts out=opt.timeout();
o Out.implicityWait(Duration of seconds (10));
o CODE OPTIMIZATION
o Driver.manage().timeouts().implicityWait(Duration of second(10));
NOTE:-
 Implicit way we have to write one time in the script. Normally we write it after launching the
browser.
 Implicit wait is working smartly in automation script if we are providing 10 sec as implicit wait
and the WebElement is present within 2 seconds then it will not wait for the remaining 8
seconds.
 If implicit wait time is over then also the web element is not loaded in the web page, then we
will get no such element exception.
Assignment
We have to apply implicit wait in all programs
 EXPLICIT WAIT  SELENIUM
o It is wait for particular condition to be satisfied.

Implicit wait wait for check box to be load in that web page.
Check box Explicit waitit will wait for to select that check box.

Implicit wait wait for sign in button to be load in that web page.
Sign in Explicit waitit will wait for to click that sign in button.

SYNTAX:-

 WebDriverwaitWait = new webDriverWait(driver, Duration of Seconds (20));


 Wait.until(Static method of ExpectedConditions class );

PROGRAM

 If explicit wait is failed then we will get “TimeoutException”.

POLLING TIME:-

 It is a time interval during explicit wait, will check the particular condition.
 Basically it is a monitor duration interval for explicit wait.
 By default polling time is 0.5 sec.
 FLUENT WAIT  SELENIUM

SYNTAX

 FluentWait wait = newFluentWait(driver);


 Wait.withTimeOut(Duration.ofSeconds(10));
 Wait.ignoring(TimeOutException.Class);
 Wait.until(Static method of Expectedconditions class);

It is same like explicit wait but in fluent wait polling time and which exception need to be held
can be customized.

PROGRAM

You might also like