0

I'll post an example and wanted to know what are the solutions for the selenium IDE operate in "modal" windows without stop the script. I will provide an online example and the script that I built: Detail does not work ...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base"
    href="http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm" />
<title>New Test</title>
</head>
<body>
    <table cellpadding="1" cellspacing="1" border="1">
        <thead>
            <tr>
                <td rowspan="1" colspan="3">New Test</td>
            </tr>
        </thead>
        <tbody>
            <!--//Open the application and wait to load the combobox-->
            <tr>
                <td>open</td>

                <td>/workshop/samples/author/dhtml/refs/showModalDialog2.htm</td>
                <td></td>
            </tr>
            <tr>
                <td>waitForElementPresent</td>

                <td>name=oHeight</td>
                <td></td>
            </tr>
            <!--//Insert height value and click "Push To Create" button-->
            <tr>
                <td>select</td>

                <td>name=oHeight</td>
                <td>label=250</td>
            </tr>
            <tr>
                <td>click</td>
                <td>css=input[type=&quot;button&quot;]</td>
                <td></td>
            </tr>
            <!--//Wait for the loading the modal page title and check the text -->
            <tr>
                <td>waitForElementPresent</td>

                <td>//h1</td>
                <td></td>
            </tr>
            <tr>
                <td>verifyTextPresent</td>
                <td>This is a modal dialog box. This page is not designed to do
                    anything except display the dialog box arguments.</td>
                <td></td>
            </tr>
            <!--//close the screen and verify that the previous screen is loaded from the height field-->
            <tr>
                <td>close</td>
                <td></td>

                <td></td>
            </tr>
            <tr>
                <td>selectWindow</td>
                <td>null</td>
                <td></td>
            </tr>
            <tr>
                <td>waitForElementPresent</td>
                <td>name=oHeight</td>
                <td></td>
            </tr>

        </tbody>
    </table>
</body>
</html>

1 Answer 1

0

Web applications don't actually have modal dialogs, with the exception of browser dialogs (e.g., "Save file as ...") and JavaScript's window.alert(), window.prompt(), and window.confirm(). Everything else is either a separate window (as in traditional web apps) or an overlay that blocks access to the elements behind it (as in modern, AJAXy, web apps).

In the case of a separate window, you need to waitForPopUp ...windowname... and then selectWindow ...windowname..., then selectWindow (without a name) to switch back.

In the case of an overlay, you can address it just like anything else in the page, but you may be surprised what the element locators may be (or maybe you won't be). Use Firefox's "XPather" or "Firebug" add-on to figure out the correct XPath expressions.

0

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.