Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to Webdriver. I need to automate a scenario on Mozilla,
System info: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_27'

I have a scenario to create a user and login with the user created. So when I login with the user created, upon login a iframe - modal dialog box displayed asking for the user to change the temporary password.

I'm not able to manipulate the webelements in the Dialog Box. Its always says "Unable to locate element".

I have used:


to switch to the Dialog box.

share|improve this question

I use the following code to switch to an iFrame that's embedded in my HTML, although I am unsure if it will help in your dialogue box:

        WebElement webelement= driver.switchTo().activeElement();
        ((JavascriptExecutor) driver).executeScript("document.body.innerHTML = '<br>'");
        //do whatever with weblement in here
        driver.switchTo().defaultContent(); //switches focus out of iFrame
share|improve this answer
You can also switch to a frame by name. – Sam Woods Oct 23 '12 at 16:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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