In most of the examples that we have looked at so far, we have made use of Thread.sleep(long); to wait for an element. Someone who is new to Java might wonder what a thread is. Let's first learn about the concept of a thread.
A thread is a single sequence of execution in a program. A particular program always runs on one thread, which is called the main thread. Another type of thread is one that is started from the main thread explicitly, and is called the child thread. In all the programs that we have seen so far, the execution was done on the main thread.