Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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:

driver.switchTo().defaultContent();

to switch to the Dialog box.

share|improve this question
add comment

1 Answer

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:

driver.switchTo().frame(0);
        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
add comment

Your Answer

 
discard

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.