enter image description here

enter image description here

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

 // 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");
  • Does that sub is new browser window? or iframe? Commented Feb 4, 2015 at 11:20
  • Which error are you getting, on which line?
    – FDM
    Commented Feb 4, 2015 at 11:20
  • after clicking on add a person page I am not able to select from drop down and neither able to fill text boxes first name,middle name
    – skr
    Commented Feb 4, 2015 at 11:56
  • Every time I click on add a person link,a new frame opens with dynamic id and name each time,that why I used xpath for the same but still problem was not resolved.
    – skr
    Commented Feb 4, 2015 at 11:57
  • Yes, we know the issue, but we need the exception and on which line of code it occurs.
    – FDM
    Commented Feb 4, 2015 at 17:25

2 Answers 2


If you can List down the error you are facing, it would be good help and we can guide you better. Moreover, its better not to use xpath locators. I am pretty sure every field would have an 'id' or 'name' and using that would be a better approach.

The dialogue box that opens up when you hit the 'Add Name' button might have an iframe and you should first switch to the iframe and then you can push information into the fields. Following is the code to switch to iframe.

  • I have attached HTML code above,it is frame with id ptModContent_0 and name as ptModContent_0 but this changes every time when add a person link is clicked on.I am switching to that frame but since id and name is dynamic so that's why I have to use xpath but still was unsuccessful in automating it.
    – skr
    Commented Feb 4, 2015 at 12:06
  • You're saying the frame id also changes every time you click on 'Add People' button? Commented Feb 5, 2015 at 5:21
  • yes frame id and name both gets changed each time a add a person link is clicked on.@jarree
    – skr
    Commented Feb 6, 2015 at 11:18
  • Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"ptModFrame_0"} Command duration or timeout: 31 milliseconds:This is the error I am getting @ Frederik De Mets
    – skr
    Commented Feb 6, 2015 at 11:40
  • Though the below error clearly says the error about frame but my problem is id and name of the frame is dynamic and it didn't get resolved even after using xpath @Frederik De Mets
    – skr
    Commented Feb 6, 2015 at 12:02

You may have already found a solution.

I faced the same issue when was doing automation for peoplesoft application.

Since the other solutions provided here did not work for me, I had to find a solution myself

Solution: If you have already used a driver.switchto.frame command then before moving to next iframe switch back to default content using driver.switchto.defaultcontent().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.