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]