Re: [wtr-general] Re: Javascript pop uo using firewatir

2010-11-26 Thread Amit Kulkarni
Hello,
Is there any difference running watir popup scripts for Firewatir and in
Watir.
This is because i am using Firewatir for ubuntu machine.I am getting an
error undefined method `enabled_popup' for nil:NilClass (NoMethodError)

Below is my code :
require 'rubygems'
require 'firewatir'
#require 'watir/contrib/enabled_popup'

Watir::Browser.default = 'firefox'
Browser = Watir::Browser.new
Browser.goto(http://localhost:3002/users;)
Browser.link(:id, del_2).click_no_wait
#popup_clicker(OK, 3)
#Browser.button(:id, /someText/).click_no_wait


hwnd = $b.enabled_popup(50)
 if (hwnd)  #yeah! a popup
  popup = WinClicker.new
  popup.makeWindowActive(hwnd)
  if browsername == firefox
popup.clickWindowsButton(FireFox, OK, 30)
  else
popup.clickWindowsButton(The site at http://www.makemytrip.co.in  says:
, OK, 30)
  end
end

Now if i uncomment the 3rd line i.e. require 'watir/contrib/enabled_popup'
then it shows me an error gem_original_require': no such file to load --
firewatir/contrib/enabled_popup (MissingSourceFile)

My firewatir versions are firewatir (1.6.7, 1.6.5)

2010/11/25 Jari Bakken jari.bak...@gmail.com

 With watir-webdriver, instead of calling execute_script yourself you can
 use the helpers provided by the optional require:


 https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/extensions/alerts.rb


 https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/extensions/alerts.rb
 2010/11/24 Alister Scott alister.sc...@gmail.com

 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 amitkkulkarni...@gmail.com

 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 rajivkumarnandv...@gmail.com

 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 
 jadhav.praja...@gmail.com 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 amitkkulkarni...@gmail.com

 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

Re: [wtr-general] Methods written in Tear down not working consistently

2010-11-26 Thread Željko Filipin
On Fri, Nov 26, 2010 at 7:53 AM, Pavithra pavi...@gmail.com wrote:
 After the execution of first tc (in the test script), Tear down works
 exactly fine.

You do not call teardown method anywhere in the code you have provided. Are
you using test/unit?

Željko

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Watir Console issues

2010-11-26 Thread Željko Filipin
On Wed, Nov 24, 2010 at 9:10 PM, Ethan notet...@gmail.com wrote:
 I don't think watir console is maintained or really supported.

Should we remove it from Watir then?

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Error message while typing the command require 'Watir'

2010-11-26 Thread Sudeep
Hi,

I have just started writing scripts in WATIR.
When I write the command  gem -v  I am getting the result as 1.3.7 .

But I am getting the following error in the command prompt while I
write the command :

require 'Watir' or
require 'watir'

It shows the following error message

C:\Documents and Settings\sudeeppirb
irb(main):001:0 require 'Watir'
LoadError: no such file to load -- Watir
from (irb):1:in `require'
from (irb):1
irb(main):002:0 require 'watir'
LoadError: no such file to load -- watir
from (irb):2:in `require'
from (irb):2

Please can you guide me as I am completely new to writing scripts in
WATIR. Do I need to load some files to get rid of this error???


Thanks in advance,
Sudeep.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Error message while typing the command require 'Watir'

2010-11-26 Thread Željko Filipin
On Fri, Nov 26, 2010 at 12:10 PM, Sudeep sudeeppattn...@gmail.com wrote:
 require 'Watir' or
 require 'watir'

You should only use require 'watir'

 irb(main):002:0 require 'watir'
 LoadError: no such file to load -- watir

Do you have Watir installed?

Try this from command line: gem list watir

Also, maybe you have to require rubygems first. Try this in IRB:

require rubygems
require watir

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Error message while typing the command require 'Watir'

2010-11-26 Thread sudeep pattnaik
Hi Željko,

Thanks for the guidance. If i write only the command  require watir  
then it is giving the result as false. but after writing  require
rubygems  it is returning the value as true.

The following is the result:

C:\Documents and Settings\sudeeppirb
irb(main):001:0 require watir
LoadError: no such file to load -- watir
from (irb):1:in `require'
from (irb):1
irb(main):002:0 require rubygems
= true
irb(main):003:0 require watir
= true


FYI,  I have installed Ruby 1.8.6 and installed WATIR using the command
 gem install watir .


Regards,
Sudeep







On Fri, Nov 26, 2010 at 4:50 PM, Željko Filipin 
zeljko.fili...@wa-research.ch wrote:

 On Fri, Nov 26, 2010 at 12:10 PM, Sudeep sudeeppattn...@gmail.com wrote:
  require 'Watir' or
  require 'watir'

 You should only use require 'watir'


  irb(main):002:0 require 'watir'
  LoadError: no such file to load -- watir

 Do you have Watir installed?

 Try this from command line: gem list watir

 Also, maybe you have to require rubygems first. Try this in IRB:

 require rubygems
 require watir

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

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


RE: [wtr-general] Methods written in Tear down not working consistently

2010-11-26 Thread Bey Gmail
Caveat: I've never written a line of code in Watir (nor Ruby) so my response
may be totally off (maybe even )...
...
What are you tearing down?
Seems to me like you are going to the home page.
Wouldn't tear down mean that you would close the session and the browser?
In all oo paradigms I know, a teardown means an instance is nullified
(torn down) so it ceases to exist and can be subject to garbage collection.
...
Again, see caveat above
Bey

-Original Message-
From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com]
On Behalf Of Pavithra
Sent: Friday, November 26, 2010 1:53 AM
To: Watir General
Subject: [wtr-general] Methods written in Tear down not working consistently

I have written four test cases in a single script and while running
the same methods written in Tear Down is not working consistently
either for 2nd or 3rd test case and for 4th test case.

I have the following piece of code in Tear down function in my test
script:

def teardown
 Amcp.tophomelink()
end

Under Main.rb:

class Amcp
   @@link_Headhome=$browser.link(:text,Home)
  class_attr_reader(:link_Headhome)

   def self.tophomelink()
   puts Tearing down
   self.link_Headhome.click()
   sleep(10)
  end
end


After the execution of first tc (in the test script), Tear down works
exactly fine. But after the execution of 2nd test case, Teardown is
getting executing -- getting into tophomelink() and printing tearing
down in the result; however the headhome link is not getting clicked
(no error thrown also). Its gng to 3rd test case and its failing
(since its failing to locate the element in that page); its tearing
down properly in 3rdtest and 4th test case is getting executed
properly but again failing to click the head home link (under tear
down) for the 4th test case.

I am facing this stupid behavior everyday and I am getting mad because
of this. Kindly help me out to resolve the issue.

Thanks in Advance,
Pavithra

-- 
Before posting, please read http://watir.com/support. In short: search
before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Watir Console issues

2010-11-26 Thread Ethan
probably. I don't think it's useful - it is just a somewhat opinionated irb.


On Fri, Nov 26, 2010 at 04:19, Željko Filipin zeljko.fili...@wa-research.ch
 wrote:

 On Wed, Nov 24, 2010 at 9:10 PM, Ethan notet...@gmail.com wrote:
  I don't think watir console is maintained or really supported.

 Should we remove it from Watir then?

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

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com