I'd try Watir-Webdriver and see if the execute_script code works.
Browser.execute_script("
window.confirm = function() {return true}")
Cheers
Alister Scott
Brisbane, Australia
Watir Web Master: http://watir.com
Blog: http://watirmelon.com
LinkedIn: http://www.linkedin.com/in/alisterscott
"There are two ways to get enough: One is to continue to accumulate more and
more. The other is to desire less." *~ G. K. Chesterton*
2010/11/24 Amit Kulkarni <[email protected]>
> Hi,
> I tried the code but it gives me error as "gem_original_require': no such
> file to load -- win32ole (MissingSourceFile)"
> I am working on Ubuntu machine so could not install the windows gem.
> How to solve this?
>
> 2010/11/23 Rajiv Nanduani <[email protected]>
>
> try this
>>
>> $autoit = WIN32OLE.new("AutoItX3.Control")
>> sleep(5)
>>
>> if @browserType == "firefox"
>>
>> Thread.start do
>> @browser.link(:href, /page/).click
>> end
>> sleep(5)
>>
>> elsif @browserType == "ie"
>>
>> Thread.start do
>> @browser.link(:href, /page/).focus
>> end
>> sleep(5)
>> $autoit.Send("{ENTER}")
>>
>> else
>> @@log.error(@browserType + " is NOT a valid Browser
>> Type!!!")
>> raise Exception.new(@browserType + " is NOT a valid
>> Browser Type!")
>> end
>>
>> sleep(5)
>> $autoit.Send("{ENTER}")
>> sleep(5)
>>
>>
>> On Mon, Nov 22, 2010 at 8:46 AM, Prajakta Jadhav <
>> [email protected]> wrote:
>>
>>> Why does
>>> Browser.link(":href","/users/1").click
>>> have double quotes (" ") around :href?
>>>
>>> That is not required and I am not sure if that will work either.
>>>
>>> This is the syntax:
>>> <a href="page.htm"> ie.link(:href, /page/).click
>>>
>>> Try removing those double quotes.
>>> Hope it works.
>>>
>>>
>>>
>>> 2010/11/22 Amit Kulkarni <[email protected]>
>>>
>>> Thanks a lot for the link.
>>>> But i tried every option but no success.
>>>> If you see carefully it uses a Ajax call.
>>>>
>>>>
>>>> require 'rubygems'
>>>> require 'firewatir'
>>>> Watir::Browser.default = 'firefox'
>>>> Browser = Watir::Browser.new
>>>> Browser.goto("http://localhost:3000/users")
>>>> Browser.link(":href","/users/1").click
>>>> ----------------------------------------------error referring to this line
>>>> #Browser.execute_script("window.confirm = function() {return true}")
>>>>
>>>>
>>>> def check_for_popups
>>>> autoit = WIN32OLE.new('AutoItX3.Control')
>>>> #
>>>> # 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('Destroy', '', 1)
>>>> #
>>>> # If window found, send appropriate keystroke (e.g. {enter},
>>>> {Y}, {N}).
>>>> if (ret==1) then 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
>>>>
>>>> $popup = Thread.new { check_for_popups } # start popup handler
>>>> at_exit { Thread.kill($popup) }
>>>>
>>>> After running i get the following error
>>>>
>>>> js_eval': missing ; before statement (JsshSocket::JSSyntaxError)
>>>> from
>>>> /var/lib/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/jssh_socket.rb:27:in
>>>> `js_eval_method'
>>>> from
>>>> /var/lib/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/element.rb:936:in
>>>> `enabled?'
>>>> from
>>>> /var/lib/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/element.rb:922:in
>>>> `assert_enabled'
>>>> from
>>>> /var/lib/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/element.rb:1072:in
>>>> `click'
>>>> from user_destroy.rb:6
>>>>
>>>>
>>>>
>>>> On Thu, Nov 18, 2010 at 2:36 PM, Željko Filipin <
>>>> [email protected]> wrote:
>>>>
>>>>> On Thu, Nov 18, 2010 at 8:21 AM, Amit Kulkarni <
>>>>> [email protected]> wrote:
>>>>> > On delete action popup is there which onclick it shows a pop up box
>>>>> along with two buttons i.e. Ok and Cancel
>>>>>
>>>>> Maybe something from here could help you:
>>>>>
>>>>> http://wiki.openqa.org/display/WTR/Pop+Ups
>>>>> http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups
>>>>>
>>>>> Željko
>>>>> --
>>>>> watir.com - community manager
>>>>> watirpodcast.com - host
>>>>> testingpodcast.com - audio podcasts on software testing. all of them
>>>>>
>>>>> --
>>>>> Before posting, please read http://watir.com/support. In short: search
>>>>> before you ask, be nice.
>>>>>
>>>>> [email protected]
>>>>> http://groups.google.com/group/watir-general
>>>>> [email protected]<watir-general%[email protected]>
>>>>>
>>>>
>>>> --
>>>> Before posting, please read http://watir.com/support. In short: search
>>>> before you ask, be nice.
>>>>
>>>> [email protected]
>>>> http://groups.google.com/group/watir-general
>>>> [email protected]<watir-general%[email protected]>
>>>>
>>>
>>> --
>>> Before posting, please read http://watir.com/support. In short: search
>>> before you ask, be nice.
>>>
>>> [email protected]
>>> http://groups.google.com/group/watir-general
>>> [email protected]<watir-general%[email protected]>
>>>
>>
>>
>>
>> --
>> RAJIV KUMAR
>>
>> <http://rajivkumarnandvani.wordpress.com/>
>> <http://learnqtphelp.blogspot.com/>
>>
>>
>>
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> [email protected]
>> http://groups.google.com/group/watir-general
>> [email protected]<watir-general%[email protected]>
>>
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]<watir-general%[email protected]>
>
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]