FYI

Its a Modal dialog box

On Nov 27, 2:07 pm, Prince3105 <[EMAIL PROTECTED]> wrote:
> Hi Mates i am a newbie to WatIR,
>
> Scenario
>
> In my application i have to check on popup's text then i have to
> confirm whether its a success message or just a information message
> then i have to close the pop up.
>
> Versions
>
> Ruby  - 1.8.6-26 Final Release
> Watir  - Watir 1.6.0
>
> I  got one function and modified as per my request and used.
>
> require 'watir/ie'
> require 'watir\contrib\enabled_popup'
> require 'watir/dialog'
> require 'watir/winClicker'
>
> def startClicker(button)
>   sleep 2
>   Timeout::timeout(1) do
>     begin
>       hwnd1 = @ie.enabled_popup(9)
>       w = WinClicker.new
>       #Get Popup Text
>       popup_text = w.getStaticText_hWnd(hwnd1)
>       #Verify popup_text match expected text
>       if popup_text.to_s == "No Changes to save"
>         # Click buttton
>         w.clickWindowsButton_hwnd(hwnd1, "#{button}" )
>         #Needed sleep time
>         sleep 0.1
>         #Check to see if popup still exists
>         Timeout::timeout(1) do
>           begin
>             hwnd = $ie.enabled_popup(9)
>             puts "The popup existed but the expected button didn't
> exist, so popup was closed without clicking a button"
>             dialog = Watir::Dialog.new
>             dialog.close
>           rescue Timeout::Error
>             puts "The popup existed and the expected button was
> clicked"
>           end
>         end
>       else
>         #Populates Error Results & Close Dialog
>         puts "Popup existed, but the current text didn't match the
> expected text, so popup was closed without clicking a button"
>         dialog = Watir::Dialog.new
>         dialog.close
>       end
>     rescue Timeout::Error
>       puts "No Popup existed"
>     end
>   end
> end
>
> @ie = Watir::IE.new
> @ie.goto("http://10.1.193.109/itrade/Login.aspx";)
> @ie.maximize
> @ie.text_field(:name,"txtUserName").set("wcorp")
> @ie.text_field(:name,"txtPassword").set("wcorp123")
> @ie.button(:name,"btnSubmit").click
> @ie.form(:id,"form1").table(:id,"tbl0").cell(:id,"el6").fire_event
> ("onMouseOver")
> @ie.form(:id,"form1").table(:id,"tbl7").cell(:id,"el57").click
> @ie.frame(:id,"plFrame").table(:id,"PendingPane1_tblPP").button
> (:id,"PendingPane1_btnNew").click
> @ie.frame(:id,"wfFrame").button
> (:id,"PageActionPane_btnSubmit").click_no_wait
> sleep 5
> startClicker("Close")
>
> But the function code returns "The popup existed but the expected
> button didn't
> exist, so popup was closed without clicking a button" error message.
>
> even If i change the pop up text and button's name it only returns the
> same error message. I have tried with regular expression but no use.
>
> So please review my code and tell me any error on the code? otherwise
> please provide a simple function.
>
> Thanks,
> Prince3105
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to