title: How to replace Wait instant of Thread.sleep() in my automation test script
body: <p>I am a new bee for the automation and I have used the <strong>JUnit to develop the automation test script on using selenium webdriver</strong> on here my requirements</p>
  
  <p>I have developed the automation test script. For some actions on my code, I want some time to execute the next command like find the element and load the pages so I use the <strong>Thread.sleep()</strong>. So now I found the info about using the Thread.sleep is a not good for the making test script</p>
  
  <p>So my question is <strong>Can anyone say then how I give the dynamic wait time to my code</strong> My code is as below,</p>
  
  <pre><code>System.setProperty("webdriver.chrome.driver", "//path of the chrome driver");
  driver = new ChromeDriver();
  
  driver.get("https://url for my org");
  Thread.sleep(5000); //to load the login page of my Org
  driver.findElement(By.xpath("my login xpath")).click();
  Thread.sleep(1000);
  driver.findElement(By.xpath("my login xpath")).sendKeys("username");
  Thread.sleep(2000);
  driver.findElement(By.xpath("my password xpath")).click();
  Thread.sleep(1000);
  driver.findElement(By.xpath("my password xpath")).sendKeys("my password");
  driver.findElement(By.xpath("login button")).click();
  Thread.sleep(6000); //for giving the time to login Org
  </code></pre>
  
  <blockquote>
    <p>I have used the different type of the wait time on my code as per my requirement.
    If I go to the wait Class Can I able to achieve the same Wait time on
    there? </p>
  </blockquote>
  
  <p>My question is different for the getting the explicit wait is provide the constant wait time to the different places like if we define the followingly,</p>
  
  <pre><code>WebDriverWait wait = new WebDriverWait(driver, 10);
  WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("element_xpath")));
  element.click();
  //for another wait 
  WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("element_xpath")));
  element.sendKeys("something"); //Here it's wait time(10 seconds) is same to the after the click action wait time. 
  </code></pre>
  
  <p>So Why I am waiting the same time for all my wait section without need? if having another way please let me know?</p>
  
  <p>If I am wrong please correct me.</p>
  
  <p>Thanks.</p>