The Ruby Code:
# Function to look for popups
def check_for_popups
autoit = WIN32OLE.new('AutoItX3.Control')
#autoit.Opt("WinTitleMatchMode", 4)
#
# Do forever - assumes popups could occur anywhere/anytime in your
application.
loop do
# Look for window with given title. Give up after 1 second.
#ret = autoit.WinWait('Microsoft Internet Explorer', '', 1
ret = autoit.WinWait(ARGV[0], '', 1)
#
#puts "HERE"
# If window found, send appropriate keystroke (e.g. {enter}, {Y}, {N}).
if (ret==1) then
autoit.ControlClick(ARGV[0],'',ARGV[1])
$flag=true
exit(0)
#autoit.Send('{enter}')
end
#
# Take a rest to avoid chewing up cycles and give another thread a
go.
# Then resume the loop.
#sleep(3)
end
end
#
# MAIN APPLICATION CODE
Timeout::timeout(ARGV[2].to_i) do
begin
check_for_popups
#popuphandle
if $flag==true then
exit(0)
end
rescue Timeout::Error
#puts 'No popup existed'
end
end
Here ARGV[0]=Window Title [ i need to use REG Expression]
ARGV[1] ==button text
ARGV[2]== Wait time.
--
Thanks
Pallavi
On Mon, Nov 2, 2009 at 5:22 PM, Pallavi Sharma <[email protected]>wrote:
> Angrez
>
> I have attached both the html page and auto it code, and on clicking the
> button a popup window appears and on clicking on the popup nothing happens,
> whether you click ok or cancel
>
> The ruby code for this is not working with Regular Expression Angrez. That
> is why i switched to Auto it.
>
> But this works only on IE and not on FireFox.
>
> The winclicker is not working with regular expression.
>
> Can you please send me the winclicker code which works with Regular
> expression if you can please, would be grateful.
>
> --
> Thanks
>
> Pallavi.
>
>
> On Mon, Nov 2, 2009 at 5:17 PM, Angrez Singh <[email protected]> wrote:
>
>> If you post the HTML code along with ruby code it would be helpful. No one
>> yet knows what kind of pop up you are talking about. Your HTML code shows
>> just one button clicking on which nothing happens.
>>
>> Thanks,
>> Angrez
>>
>>
>> On Mon, Nov 2, 2009 at 5:13 PM, Pallavi Sharma
>> <[email protected]>wrote:
>>
>>> 1. I am using Firewatir to work on Firefox 3.5, coz somehow my test
>>>> runs get stuck on FF 3.0 i dont know why
>>>>
>>> This should not happen. Can you let me know what is not working?
>>>
>>>>
>>>
>>> I exactly dont know Angrez but the code just hangs in there, but this is
>>> not an issue with 3.5.
>>>
>>> Can you tell me how else to debug this?
>>>
>>> On Mon, Nov 2, 2009 at 4:15 PM, Angrez Singh <[email protected]> wrote:
>>>
>>>> 1. I am using Firewatir to work on Firefox 3.5, coz somehow my test runs
>>>>> get stuck on FF 3.0 i dont know why
>>>>>
>>>> This should not happen. Can you let me know what is not working?
>>>>
>>>>>
>>>>> 2. I need to use auto it directly as some popups come which's title i
>>>>> dont know before han so i need to use REGEXPTITLE functionality
>>>>>
>>>>> 3. Now the problem is the auto it script doesn't work on FF 3.5 but on
>>>>> 3.0 and my Firewatir doesnot work on 3.0 but on 3.5
>>>>>
>>>>> Are they javascript popups? If yes, why are you not using the in-build
>>>> pop up clicker?
>>>>
>>>> Thanks,
>>>> Angrez
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---