I am trying to automate Peoplesoft 9 based Web application on Firefox 20.0.1. On clicking a search icon another form opens which I thought to be a pop-up and tried my code -


but this threw an exception Alert not present!.

Then I tried to revisit the HTML and found it to be within an iframe and, tried to switch to the iframe but in vain! Below is the CSS path of the item I want to select -

html body.PSSRCHPAGE form div#win0divSEARCHADV table.PSPAGECONTAINER tbody tr td select##ICKeySelect.PSDROPDOWNLIST

The HTML tag hierarchy looks like -

iframe > .. form > .. select > ..

Java Code -

import java.util.concurrent.TimeUnit;

// import javax.swing.JOptionPane;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class SeleniumTest3 {

 * @param args
public static void main(String[] args) {
    // TODO Auto-generated method stub

    try {

    // open a firefox driver
    WebDriver wd1 = new FirefoxDriver();
    wd1.manage().timeouts().implicitlyWait(59, TimeUnit.SECONDS);

    // open the url and login

    // click the timesheet link and switch to iframe

    // click the search task icon

    // select option from combo-box
    new Select(wd1.findElement(By.id("#ICKeySelect"))).selectByVisibleText("Task Name");

    } catch (Exception exc) {
        // JOptionPane.showMessageDialog(null,"Better Luck Next Time :(" /*+ exc.getMessage()*/);


  • 1
    Can you post your code where you try to switch to the iframe? What happens when you try it - does it throw an error? May 9, 2013 at 14:14
  • @vincebowdren I have added the entire Java code now. I am not able to locate the PSEDITBOX. The code works fine till wd1.switchTo().defaultContent()
    – Saikat
    May 9, 2013 at 14:23
  • 2
    Thanks, that's useful. From a look at the code, it's not obvious whether you have a problem with switching, or with that particular field PSEDITBOX. If you move the call to PSEDITBOX further up (before you switched to the iframe), does it work there? May 9, 2013 at 14:42
  • @vincebowdren Not does not work. I commented the 2nd swtichTo
    – Saikat
    May 9, 2013 at 14:47
  • 2
    That sounds like you have a problem with your PSEDITBOX control then. Is it in the iframe, or in the default content? And can you verify that it definitely exists, uniquely, as identified by the class? May 9, 2013 at 15:13

1 Answer 1


Solved now.

The PSEDITBOX is contained in another iframe which I missed. So I have just added one line now and it solved the issue -


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.