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