sir,

I used the method you suggested but, it is not working i've to click
the popup button manually to go further testing the application. I'm
putting the code i'm using for the handling popup below, please
suggest me corrections that are to be made

require 'Watir'
require 'test/unit'
require 'watir/dialog'
require 'watir/contrib/enabled_popup'

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("")
ie.text_field(:name, "Login1$Password").set("")
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.button(:id, "ctl00_ContentPlaceHolder1_btnUpload").click

#popup

def popupchecker(text)
  sleep 10
  Timeout::timeout(2) do
if (ie.enabled_popup)
  wc = WinClicker.new
  wc.clickWindowsButton(/Windows Internet Explorer/, "OK", 30)
end
end
end

#Below is the code for operations after the popup disappears
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



On Mar 23, 8:29 pm, Jim Matthews <jim_m...@swbell.net> wrote:
> I have figured a few things out with the click_no_wait problem.  This
> potentially affects any program that uses the Ruby "system" call,
> which click_no_wait does. There is also appears to be a problem with
> Watir#wait_until, that is used by enabled_popup, which is used to
> check for the presence of apopup.  The details follow:
>
> First, I think the problem with click_no_wait not actually not
> clicking the button/link is a Ruby 1.8.6-27 problem.  It is because
> the quoted string is not passed into Ruby correctly.
>
> On a Ruby 1.8.6-26 system, the following happens:
>
> C:\>ruby --version
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
>
> C:\>ruby -e "puts \"Does this work?\""
> Does this work?
>
> C:\>
>
> However, on a 1.8.6-27 system, the following happens:
>
> C:\>ruby --version
> ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
>
> C:\>ruby -e "puts \"Does this work?\""
> -e:1: unterminated string meets end of file
>
> C:\>
>
> There is a second problem.  When you set the timeout for clicking 
> thepopupbutton, Watir times out first:
> .
> .
> .
> if (ie.enabled_popup)
>   wc = WinClicker.new
>   wc.clickWindowsButton(/Internet Explorer/, "OK", 30)
> end
>
> >ruby javatest.rb
>
> c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/waiter.rb:
> 59:in `wait_until': Timed out after 4.006 seconds.
> (Watir::Exception::TimeOutException)
>     from c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/
> waiter.rb:80:in `wait_until'
>     from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/contrib/
> enabled_popup.rb:10:in `enabled_popup'
>     from javatest.rb:13
>
> >Exit code: 1
>
> So even though I have the click set to not timeout until after 30
> seconds, Watir seems to timeout after about 4 seconds.
>
> There is a temporary workaround for this that works for me.  Because I
> was getting the Watir timeout before thepopupcame up, I added a
> sleep to my popupchecker method before the Timeout::timeout.  So the
> first part of the popupchecker method looks like this:
>
> def popupchecker(text)
>   sleep 10
>   Timeout::timeout(2) do
>
> Note that I give this as a temporary solution until the wait_until is
> fixed.
>
> Jim
>
> On Mar 3, 10:52 am, Jim Matthews <jim_m...@swbell.net> wrote:
>
>
>
> > Here are the steps to reproduct the problem.  First bring up unittests
> > \html\popups1.html in IE.
>
> > \Ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\unittests\html\popups1.html
>
> > Next run this script.  I have extra "puts" in it to try to figure out
> > what is going on. They can be remvoed or commented out.
>
> > Jim
>
> > require 'watir'
> > require 'watir/ie'
> > require 'watir/testcase'
> > require 'watir/contrib/enabled_popup'
>
> > class StepTests < Watir::TestCase
> >   def test_01_step_test
> >     browser = Watir::IE.attach(:title, /Test page for/)
> >     browser.row(:index, 3).button(:type, 'button').click!
> >     popupchecker(browser, 'OK')
> >   end
> >   def popupchecker(browser, text)
> >     Timeout::timeout(2) do
> >       begin
> >         puts "Inside begin of popupcuecker."
> >         puts "browser.enabled_popup == #{browser.enabled_popup}"
> >         if browser.enabled_popup
> >           puts "In if in popupchecker."
> >           hwnd = browser.enabled_popup(5)
> >           puts hwnd.to_s
> >           w = WinClicker.new
> >           w.makeWindowActive(hwnd)
> >           w.clickWindowsButton_hwnd(hwnd, text)
> >         end
> >         rescue Timeout::Error
> >           puts 'Nopopupexisted.'
> >       end
> >     end
> >   end
> > end
>
> > On Mar 2, 10:12 am, Jim Matthews <jim_m...@swbell.net> wrote:
>
> > > I am trying to deal with javascript popups.  I have created the
> > > popupchecker method described on the wiki.
>
> > > When I usedclick_no_wait,  thepopupcame up but was not dismissed.
> > > Someone suggested that I try click! instead ofclick_no_waitbecause
> > > of some problems mentioned in recent posts.  I did that and click!
> > > worked for the firstpopup.  It dismissed it and the script continued.
>
> > > When the script got to the secondpopup, neitherclick_no_waitnor
> > > click! worked to dismiss thepopup.  I put some "puts" statements is
> > > the popupchecker method and it appears from that, that popupchecker is
> > > not getting called the second time until after I manually dismiss the
> > > secondpopup.
>
> > > I know the popupchecker code works because it successfully dismisses
> > > the firstpopupand because I have used fxri with popupchecker to
> > > dismiss both the popups.
>
> > > Does anyone have an idea what is going on or something different to
> > > try?
>
> > > Jim- 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