Let's have a look at the different types of synchronization. There are two types of synchronization:
- Unconditional synchronization: In this case, the testing tool waits until the time specified in the wait statement—for example, Thread.sleep(5000); is an instruction for Selenium to wait for five seconds (the sleep method accepts the time in milliseconds). Say that the web element shows up in 3 seconds. In this case, 2 seconds will be a wasted, as Selenium will keep on waiting for 5 seconds.
- Conditional synchronization: In this case, we specify a condition that has to be satisfied before throwing a NoSuchElementException. If the specified condition is met, then Selenium will not wait any longer but will move on to execute ...