I am new to Selenium WebDriver. I am trying to work on a script to Add a Person in PeopleSoft HCM Application. Basically, On the Personal Data Main page, you first start by adding a Effective Date in to a Date Field and click on Add Name button that opens a Sub Page on the Main page. The Sub Page has First Name , Middle Name , Last Name etc fields. You enter this fields and click OK to go back to Main Page and carry on other data entries.
When I recorded through Selenium IDE, it clicks on the Add Name Button and the sub page opens and the IDE can enter text to the name fields. However when I am using the Web Driver Code, it is not able to push the data to the sub page.
How can I get hold of the sub page through the code. I tried the driver.switchTo().window command , and this is not working.
Any Help on this would be a great help.
Below is my code for the same ,I tried many permutations and combinations but was failed in the end
driver.findElement(By.id("DERIVED_NM_LVL2_UPDATE_NAME_BTN$0")).click();
// String wHandle = driver.getWindowHandle();
// driver.switchTo().window(wHandle);
// driver.switchTo().frame(driver.findElement(By.xpath("//div[@id='ptModContent_6']/iframe")));
new Select(driver.findElement(By.id("DERIVED_CORE_NM_NAME_PREFIX"))).selectByVisibleText("Dr");
driver.findElement(By.xpath(".//*[@id='DERIVED_CORE_NM_FIRST_NAME']']")).clear();
driver.findElement(By.xpath(".//*[@id='DERIVED_CORE_NM_FIRST_NAME']']")).sendKeys("vcxvx");
driver.findElement(By.xpath(".//*[@id='DERIVED_CORE_NM_MIDDLE_NAME']")).clear();
driver.findElement(By.xpath(".//*[@id='DERIVED_CORE_NM_MIDDLE_NAME']")).sendKeys("vcxv");
driver.findElement(By.xpath(".//*[@id='DERIVED_CORE_NM_LAST_NAME']")).clear();
driver.findElement(By.xpath(".//*[@id='DERIVED_CORE_NM_LAST_NAME']")).sendKeys("vcx");
driver.findElement(By.id("#ICSave")).click();