I'm new to Webdriver. I need to automate a scenario on Mozilla,
System info: os.name: '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.

1 Answer 1


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
  • You can also switch to a frame by name.
    – Sam Woods
    Oct 23, 2012 at 16:11

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.