title: Wait until the method returns in Selenium
body: <p>I'm new to Selenium and I have a method in like this</p>
  
  <pre><code>public  Test login(String username,String password)
  {
      accountName.sendKeys(username);
      passwordField.sendKeys(password);
  
      signInButton.click();
      return PageFactory.initElements(driver,Test.class);
  }
  </code></pre>
  
  <p>Login can take some time to complete. I wish I could wait until <code>login</code> method returns before other method calls. Are there any way in selenium to do this?</p>