Synchronization types

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 the next statement. In this chapter, we will look at three types of wait that fall into this category: the implicit wait, explicit wait, and the fluent wait.

Let's look at these different types of synchronization in more detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset