You have to give the exact caption of the window which is appearing as
popup. In your case that caption of the pop up is "FILE
UPLOADED SUCCESSFULLY" try this code:

autoit = WIN32OLE.new('AutoItX3.Control')
    Opt("WinTitleMatchMode", 3)
autoit.WinWait('FILE UPLOADED SUCCESSFULLY', '', 2)

autoit.WinActivate('FILE UPLOADED SUCCESSFULLY')
autoit.Send('{enter}')

if you are online in g-talk you can ping me.

Regards,
Kiran Y
kiranyajaman...@gmail.com

On Thu, Apr 9, 2009 at 11:02 AM, spike <vinaykumarl...@gmail.com> wrote:

>
> Ya it still didnt work for me
>
> Test Scenario
>
> I'm running on windows platform with IE7
> I've to upload a file to the application i'm testing. to do that i'm
> login to the application and navigating to the respective page where
> i've to upload the file. I'm able to upload the file, upon
> successfully uploading the fiel a POPUP appears with the msg "FILE
> UPLOADED SUCCESSFULLY" and it has a button "OK" which has to clicked
> for the popup to disappear. i'm stuck here. the code is not clicking
> the "OK" button. following is the script i'm running.
>
> require 'Watir'
> require 'test/unit'
>
>
> class Manageresources < Test::Unit::TestCase
>
> def test_manage_resources
> ie = Watir::IE.start "http://192.168.25.10:215/";
> ie.maximize()
> ie.text_field(:name, "Login1$UserName").set("vinay")
> ie.text_field(:name, "Login1$Password").set("welcome")
> ie.checkbox(:name, "Login1$RememberMe").click
> ie.button(:value, "Log In").click
> ie.link(:href, "http://192.168.25.10:215/administrator/
> Default.aspx").click
> ie.link(:href, "javascript:__doPostBack
> ('ctl00$Menu1','Resources')").click
> ie.link(:href, "http://192.168.25.10:215/admin/
> ManageResources.aspx").click
> ie.link(:id, "ctl00_ContentPlaceHolder1_lnkAdd").click
> ie.radio(:id, "ctl00_ContentPlaceHolder1_rdCourses_1").click
> ie.button(:id, "ctl00_ContentPlaceHolder1_btnNext").click
> ie.file_field(:id, "ctl00_ContentPlaceHolder1_Uploadfile").set("D:\
> \BCSBI.zip")
> ie.file_field(:id, "ctl00_ContentPlaceHolder1_btnUpload").click
> # For handling popups
>  require 'win32ole'
>   autoit = WIN32OLE.new('AutoItX3.Control')
>  #  Opt("WinTitleMatchMode", 3)
> autoit.WinWait('Windows Internet Explorer', '', 2)
>
>
> autoit.WinActivate('Windows Internet Explorer')
> autoit.Send('{~}')
>
>
>
>
>  if ie.radio(:id,
> "ctl00_ContentPlaceHolder1_RdlistisFeedback_1").isSet?
>    puts "IS FEEDBACK option Yes is selected"
>    else
>      ie.radio(:id,
> "ctl00_ContentPlaceHolder1_RdlistisFeedback_1").click
>    end
>    ie.select_list(:id, "ctl00_ContentPlaceHolder1_DdlAccesstype").set
> ("Public")
>    ie.select_list(:id,
> "ctl00_ContentPlaceHolder1_DdlApprovaltype").set("Admin")
>
> end
> end
>
> Please suggest me a solution
>
>
> thankingyou
>
> On Apr 9, 9:24 am, kiran yajamanyam <kiranyajaman...@gmail.com> wrote:
> > missed this piece of code
> >
> > require 'win32ole'
> >
> > still if it wont work just comment out  Opt("WinTitleMatchMode", 3) code
> and
> > try.
> >
> > If still it wont work please send me the scenario u are testing i will
> try
> > and give u the code.
> >
> > Regards,
> > Kiran Y
> >
> >
> >
> > On Thu, Apr 9, 2009 at 9:26 AM, spike <vinaykumarl...@gmail.com> wrote:
> >
> > > I used this code but i'm getting the following error
> >
> > > 1) Error:
> > > test_manage_resources(Manageresources):
> > > NoMethodError: undefined method `Opt' for #<Manageresources:0x2b697c8>
> > >    manageresource.rb:25:in `test_manage_resources'
> >
> > > so please suggest some solution...
> >
> > > On Apr 9, 8:40 am, kiran yajamanyam <kiranyajaman...@gmail.com> wrote:
> > > > hi,
> >
> > > > handle the popup window using autoit.
> > > > install autoit software. and use the followinf code
> >
> > > > autoit = WIN32OLE.new('AutoItX3.Control')
> > > >     Opt("WinTitleMatchMode", 3)
> > > > autoit.WinWait('Windows Internet Explorer', '', 2)
> >
> > > > autoit.WinActivate('Windows Internet Explorer')
> > > > autoit.Send('{enter}')
> >
> > > > This will work fine with out any issue
> >
> > > > Regards,
> > > > Kiran Y
> >
> > > > On Wed, Apr 8, 2009 at 5:56 PM, spike <vinaykumarl...@gmail.com>
> wrote:
> >
> > > > > Hi
> >
> > > > > I'm woking on windows platform and IE7 using "WATIR" I've used the
> > > > > following code for handling "JavaScript" popup
> >
> > > > > require 'win32ole'
> > > > > wsh WIN32OLE.new('Wscript.Shell')
> > > > >  wsh.AppActivate('Windows Internet Explorer')
> > > > >  wsh.Sendkeys('{ENTER}')
> >
> > > > > but its not working i'm getting the following error.
> > > > >  1) Error:
> > > > > test_manage_resources(Manageresources):
> > > > > NoMethodError: undefined method `wsh' for
> #<Manageresources:0x2b8c4bc>
> > > > >    manageresource.rb:24:in `test_manage_resources'
> >
> > > > > Please Please please... give a solution to my problem i'm stuck
> with
> > > > > handling popup from past 2 days..
> >
> > > > > thankingyou- Hide quoted text -
> >
> > > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to