How to login on Goibibo website using selenium
<p>I am trying to automate <code>Goibibo</code> Website in <code>Selenium</code> using <code>Java</code>. After Clicking on <code>Sign</code> in Tab, login pop up is displaying. How to switch to pop up so that I can enter details into the <code>Goibibo</code> Pop up. I wrote the following code:</p>

<pre><code>public class Testclass1 {

    public static void main(String[] args)  throws InterruptedException{
        System.setProperty("webdriver.chrome.driver", "D://chromedriver_win32//chromedriver.exe");
        WebDriver Driver = new ChromeDriver();
        Driver.manage().window().maximize();        
        Driver.get("https://www.goibibo.com/");
        Thread.sleep(5000);
    //HANDLE THE POP UP     
          String handle = Driver.getWindowHandle();
          System.out.println(handle);
            // Click on the Button "New Message Window"
            Driver.findElement(By.linkText("Sign In")).click();
            Thread.sleep(3000);
            // Store and Print the name of all the windows open               
            Set handles = Driver.getWindowHandles();
            System.out.println(handles);
            // Pass a window handle to the other window
            for (String handle1 : Driver.getWindowHandles()) {
                System.out.println(handle1);
                Driver.switchTo().window(handle1);
                }
            Thread.sleep(3000);
            Driver.findElement(By.name("username")).sendKeys("bittu.agrawal773@gmail.com");
        //WAIT
    }
}
</code></pre>