Sign in to follow this  
Followers 0

How can i get a Modal Dialog's text

7 posts in this topic

Posted

Hi Mates,

I am Newbie to AutoIT and Watir, before that i was using QTP for our testing process, recently i have started the QTP scripts into Watir.

I am working in a web application, where there are so many Modal Dialogs have been used to covey error message. I tried to get the popup text by using Watir but i cant get anything, only nil value i got. When i tried the same with Autoit i got the url in the Modal dialog. Please let me know if any ways are available to access the Modal dialog's text.

@ie.frame(:id,"wfFrame").button(:id,"PageActionPane_btnSubmit").click_no_wait

sleep 10
puts title1 = autoit.WinGetTitle("")
puts autoit.WinWait(title1,3)
puts autoit.WinGetText(title1)

The above code returns the window handle, title correctly. But it returns the url only from the Modal Dialog. please see the attached screen shot of the Modal dialog.

If is it possible in Autoit please let me know about the way and code.

Thanks.

post-43709-1228740506_thumb.jpg

Share this post


Link to post
Share on other sites



Posted (edited)

Hi Mates,

I am Newbie to AutoIT and Watir, before that i was using QTP for our testing process, recently i have started the QTP scripts into Watir.

I am working in a web application, where there are so many Modal Dialogs have been used to covey error message. I tried to get the popup text by using Watir but i cant get anything, only nil value i got. When i tried the same with Autoit i got the url in the Modal dialog. Please let me know if any ways are available to access the Modal dialog's text.

@ie.frame(:id,"wfFrame").button(:id,"PageActionPane_btnSubmit").click_no_wait

sleep 10
puts title1 = autoit.WinGetTitle("")
puts autoit.WinWait(title1,3)
puts autoit.WinGetText(title1)

The above code returns the window handle, title correctly. But it returns the url only from the Modal Dialog. please see the attached screen shot of the Modal dialog.

If is it possible in Autoit please let me know about the way and code.

Thanks.

I've used the MouseDrag option before from the beginning of the text to the end and then done a CTRL C to clipboard. if you can copy the text then read up on the clipboard functions...life saver for me. Failing this will mean having to use OCR technique, which I personally haven't tried so maybe another user can assist. Edited by IndyUK

Share this post


Link to post
Share on other sites

Posted

I've used the MouseDrag option before from the beginning of the text to the end and then done a CTRL C to clipboard. if you can copy the text then read up on the clipboard functions...life saver for me. Failing this will mean having to use OCR technique, which I personally haven't tried so maybe another user can assist.

Thanks for instant reply, but Ctrl C is not working....

Share this post


Link to post
Share on other sites

Posted

And what if you will try to get the source from that URL? :)

#Include <Inet.au3>

$sSource = _InetGetSource("http://10.1.193.109/itrade/Message.html")
ConsoleWrite($sSource)

Share this post


Link to post
Share on other sites

Posted

Thanks for instant reply, but Ctrl C is not working....

Do you mean that you're not able to highlight the text? If you can manually highlight the text then you should be able to try the following...

_ClipBoard_Empty();empty clipboard
MouseClickDrag("Left", 35, 187, 165, 187, 30);drag mouse pointer over case ref
Send("^c");copy the case ref to clipboard

That copies from a start screen location to a end screen location

If the copy worked then you should be able to paste into Notepad. If you want to see the value copied via AutoIt then..

_ClipBoard_GetData()

Hope this helps.

Share this post


Link to post
Share on other sites

Posted (edited)

And what if you will try to get the source from that URL? :)

Thanks,

When i navigate to the url it shows the layout of the Modal Dialog without the Error message. Ref the attachments. In the HTML tag error message passed as a object, so i can not access it. :-(

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Information&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
   
    <link href="App_Themes/grey/Styles.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
    function ShowMessage()
    {
        var messageDetails = new Object();
        messageDetails = window.dialogArguments;
        document.getElementById('spnMessage').innerHTML = '<br/><br/>' + messageDetails.message;
    }
    </script>

</head>
<body class="popuppage" onload="ShowMessage();">
    <form id="form1" runat="server">
        <div align="center"  style="margin-top:20px">
            <div class="popupcontent" style="margin-left:7px;width: 420px; height: 130px; vertical-align: middle">
                <div style="height: 84px;">
                    <br />
                    <div align="center">
                        <div style="float: left; padding: 15px;">
                            <img src="Images/successmessage.png" />
                        </div>
                        <div style="padding-right: 10px;">
                            <span class="hlptopic" id="spnMessage"></span>
                        </div>
                    </div>
                </div>
                <div class="popupClose" align="right">
                    <div style="top: 10px; position: relative; padding-right: 20px">
                        <input type="button" tabindex="1" class="btn" value="Close" onclick="window.close();" />
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
</html>

post-43709-1228797147_thumb.jpg

Edited by Prince3105

Share this post


Link to post
Share on other sites

Posted

Do you mean that you're not able to highlight the text? If you can manually highlight the text then you should be able to try the following...

In the Modal Dialog, i can able to click the "Close" button only, other any functions are not working especially "Ctrl C".

If you see the HTML tag, the error message passed as a object. Is it possible to access javascript in autoIt ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.