Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

How can i get a Modal Dialog's text


  • Please log in to reply
6 replies to this topic

#1 Prince3105

Prince3105

    Seeker

  • Normal Members
  • 4 posts

Posted 08 December 2008 - 12:49 PM

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.

Attached Thumbnails

  • test1.JPG








#2 IndyUK

IndyUK

    Wayfarer

  • Active Members
  • Pip
  • 84 posts

Posted 08 December 2008 - 12:53 PM

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, 08 December 2008 - 12:55 PM.


#3 Prince3105

Prince3105

    Seeker

  • Normal Members
  • 4 posts

Posted 08 December 2008 - 12:59 PM

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....

#4 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,250 posts

Posted 08 December 2008 - 01:31 PM

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

#Include <Inet.au3> $sSource = _InetGetSource("<a href='http://10.1.193.109/itrade/Message.html' class='bbc_url' title='External link' rel='nofollow external'>http://10.1.193.109/itrade/Message.html"</a>) ConsoleWrite($sSource)

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#5 IndyUK

IndyUK

    Wayfarer

  • Active Members
  • Pip
  • 84 posts

Posted 08 December 2008 - 05:10 PM

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.

#6 Prince3105

Prince3105

    Seeker

  • Normal Members
  • 4 posts

Posted 09 December 2008 - 04:34 AM

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. :-(

Plain Text         
<html xmlns="<a href='http://www.w3.org/1999/xhtml%22>' class='bbc_url' title='External link' rel='nofollow external'>http://www.w3.org/1999/xhtml"></a> <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>

Attached Thumbnails

  • ErrorMsg.JPG

Edited by Prince3105, 09 December 2008 - 04:35 AM.


#7 Prince3105

Prince3105

    Seeker

  • Normal Members
  • 4 posts

Posted 09 December 2008 - 04:41 AM

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 ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users