Q:

Selenium WebDriver Java - Registration form coming on opening a page for first time

I am opening a page for the first time but on successful loading of the page a Registration form is immediately coming. I want to work on the page that gets opened but that is not possible without handling the registration form that is immediately coming on the page load but the problem is that I am unable to switch my control to that Registration form that is opening. I am using Selenium WebDriver along with Java as the scripting language.
Since this problem is with some official project of mine so I am unable to share the exact URL but I have managed to find another URL that also acts similar to the URL that I am facing problem with. I am providing that substitute URL below:
http://way2automation.com/way2auto_jquery/index.php
In the above URL, I want to work in the page that gets loaded but am unable to do it before handling the registration form. Please tell me how to switch control to the registration form using Selenium WebDriver and Java as the language.

A:

You have to find the element using the chained search concept.The above Registration popup is not available within iframe.  So, first you have to find the Parent WebElement of the Registration form and then you can access the required element using parent element reference.
    //Finding the Parent Element of the Registration Form
    WebElement popUp=driver.findElement(By.className("fancybox-skin"));

    //Finding the Name Input Text Field using the Parent Element
    popUp.findElement(By.xpath(".//*[@id='load_form']/fieldset[1]/input")).sendKeys("Subburaj");

Similarly, you can access all the applicable registration form element using the popup element(parent element)
Note: I have tested the above piece of code and it is working fine 
Edit: Full Code:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Way2Automation {

    public static void main(String args[]){
        System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
        WebDriver driver=new ChromeDriver();
        driver.get("http://way2automation.com/way2auto_jquery/index.php");

        //Explicit wait is added after the Page load
        WebDriverWait wait=new WebDriverWait(driver,20);
        wait.until(ExpectedConditions.titleContains("Welcome"));

        WebElement popUp=driver.findElement(By.className("fancybox-skin"));

        popUp.findElement(By.xpath(".//*[@id='load_form']/fieldset[1]/input")).sendKeys("Subburaj");
        popUp.findElement(By.xpath(".//*[@id='load_form']/fieldset[2]/input")).sendKeys("987654321");

    }
}

