Firstly, when you launch a web application, the selenium test script waits for the page to be loaded before executing the test script.
Secondly, all the web elements are not loaded at the same time, in a situation like that we can use implictwait, the following statement might be helpful:
driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
Selenium will wait for maximum 5 seconds for the web elements to load before executing the test case.