Re: [wtr-general] Safari Watir / Webdriver - reasons for choosing watir or selenium...

2011-08-02 Thread Željko Filipin
On Tue, Aug 2, 2011 at 1:50 AM, qalady lau...@protopc.com wrote:
 My question is: How robust/functional is Safari Watir these days?

I think this speaks for itself:

https://github.com/redsquirrel/safariwatir/commits/master/

To make it clear, the last commit was almost a year ago. SafariWatir works,
but it is not in active development.

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

-- 
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] Chrome is getting closed even I do not use browser.close() method.

2011-08-02 Thread Amit Bobade
Dear Željko,

I am still facing this problem. Any updates?

Thanks,
Amit.

2011/7/22 Amit Bobade amit.sr...@gmail.com

 Thank you very much. Please let us know once you are done. Thanks in
 advance.

 On Fri, Jul 22, 2011 at 1:48 PM, Željko Filipin 
 zeljko.fili...@wa-research.ch wrote:

 On Fri, Jul 22, 2011 at 7:50 AM, Amit Bobade amit.sr...@gmail.com
 wrote:
  My scripts are running properly but Chrome browser is getting closed
 even I do not use browser.close() method.

 To quote Jari (from
 http://stackoverflow.com/questions/6176526/chrome-browser-opens-and-closes-using-watir-webdriver
 ):

 The Chrome driver will close all browser instances when your program
 exits. It's a known issue, and its priority was fortunately bumped today -
 look for a fix soon.

 Željko
 --
 watir.com - community manager
 watir.com/book - author
 watirpodcast.com - host

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




 --
 Thanks and Regards,
 Amit




-- 
Thanks and Regards,
Amit

-- 
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] Chrome is getting closed even I do not use browser.close() method.

2011-08-02 Thread Željko Filipin
On Tue, Aug 2, 2011 at 10:43 AM, Amit Bobade amit.sr...@gmail.com wrote:
 I am still facing this problem. Any updates?

As far as I understand the problem, it is on the Chromium side:

http://code.google.com/p/chromium/issues/detail?id=87676

The ticket status is Started. Watch the ticket.

Ž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] Chrome is getting closed even I do not use browser.close() method.

2011-08-02 Thread Jari Bakken
Den 2. aug. 2011 kl. 10:43 skrev Amit Bobade amit.sr...@gmail.com:

 Dear Željko,

 I am still facing this problem. Any updates?

You can follow this issue:

http://code.google.com/p/chromium/issues/detail?id=87676

-- 
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] The set method of file_field does not work for me

2011-08-02 Thread janssen
I used below method to set file path for file field, but after execute
my code, the file dialog did not pop up, and browser hangs.

ie.file_field(:name,'fileupload').set D:\\abc.pdf

And then I changed the file_field.rb code  (change method
click_no_wait to click), please see below

Change

def set(file_path)
  assert_file_exists(file_path)
  assert_exists
  click_no_wait
  set_file_name file_path
  open_button.click
end

To
def set(file_path)
  assert_file_exists(file_path)
  assert_exists
  click
  set_file_name file_path
  open_button.click
end

After execute my code, the file dialog pop up, but it did not input
the file path which I set, and I try to use autoit methods which is
searched in google, but still does not work, can you do me a favor ?
thanks.

My environment:
  Windows 7
  IE 8 (English)
  Watir version : 1.9.2

-- 
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] Not able to populate textarea

2011-08-02 Thread ivan_xu
watir version = 1.9.2
ruby version = 1.8.7

HI:
If i try to fill the textarea I get the following error:
Unable to locate element, using :class,
slet_tx (Watir::Exception::UnknownObjectException)

-- HTML Code -
textarea class=slet_tx rows= cols= name=/textarea
-- HTML Code -

 my Watir code ---
require 'watir'
ie = Watir::IE.new
ie.goto('http://my.woyo.com/view.php?
userid=552197nav_app=blog.detailid=00219600020079')
ie.text_field(:class, 'slet_tx').set('nice')
 my Watir code ---

Please let me know why is this erro,thanks.

Regards
Ivan_xu

-- 
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] Not able to populate textarea

2011-08-02 Thread Željko Filipin
On Tue, Aug 2, 2011 at 12:09 PM, ivan_xu ivan0921...@gmail.com wrote:
 ie.text_field(:class, 'slet_tx').set('nice')

Since text area is in a frame, you have to say it explicitly:

ie.frame(:id = zone_main_iframe).text_field(:class =
'slet_tx').set('nice')

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

-- 
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] Re: Not able to populate textarea

2011-08-02 Thread ivan_xu
Thanks a lot , I see.

On 8月2日, 下午6时14分, Željko Filipin zeljko.fili...@wa-research.ch
wrote:
 On Tue, Aug 2, 2011 at 12:09 PM, ivan_xu ivan0921...@gmail.com wrote:
  ie.text_field(:class, 'slet_tx').set('nice')

 Since text area is in a frame, you have to say it explicitly:

 ie.frame(:id = zone_main_iframe).text_field(:class =
 'slet_tx').set('nice')

 Željko
 --
 watir.com - community manager
 watir.com/book - author
 watirpodcast.com - host

-- 
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] Re: Object no longer attached to the DOM error on doing a exists call

2011-08-02 Thread Alister Scott
I have found testing an app that has a crazy amount of JavaScript that 
changes the DOM, that these exceptions are raised quite frequently.

I personally prefer the Watir 1.X behaviour, as it personally means tests 
are more reliable for me.

But, I understand the performance hit. Are we talking much slower execution 
times?

I have written about this on my blog, with some ideas I have on how to write 
scripts to avoid it: 
http://watirmelon.com/2011/08/02/watir-webdriver-obselete-element-error/

Cheers,
Alister

-- 
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] Safari Watir / Webdriver - reasons for choosing watir or selenium...

2011-08-02 Thread Alister Scott
I think the iOS driver for webdriver is *definitely* not ready for prime 
time. For example, you can't even do a .click!!! 
http://code.google.com/p/selenium/issues/detail?id=1250

That issue has been open, and not looked at, since 1 Feb. Judging from that, 
I don't see if the iOS webdriver is considered very important.

-- 
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] Re: send_keys broke in Watir 1.9.2/rautomation 0.6.3

2011-08-02 Thread Jarmo Pertman
#send_keys accepts now only strings. It accepted accidentally array of
VK_ codes in some previous version of RAutomation. Use better
solutions to capture screenshots. win32screenshot gem can help you
there https://rubygems.org/gems/win32screenshot and
https://github.com/jarmo/win32screenshot

Just `gem install win32screenshot` and start hacking :)

Jarmo

On Aug 2, 12:31 am, Dmitriy Korobskiy dkro...@gmail.com wrote:
 I'm dumping screenshots of failed scenarios. Here is my current code:

      # Take screenshot
      if defined?(browser.driver)
        browser.driver.save_screenshot(screenshot_filename + .png)
      elsif ENV[BROWSER] == 'IE'
        # Dump screenshot via Print Screen
        browser.maximize
        VK_SNAPSHOT = 0x2C
        browser.send_keys(VK_SNAPSHOT)

        word = WIN32OLE.new('Word.Application')
        word.Documents.Add
        word.Selection.Paste
        word.ActiveDocument.SaveAs(screenshot_filename + .doc)
        word.ActiveDocument.Close
        word.Quit
      end

 It used to work in IE with previous versions of Watir. Now, I'm getting
 error inside send_keys():

 undefined method `split' for 44:Fixnum (NoMethodError)
 C:/Ruby/lib/ruby/gems/1.9.1/gems/rautomation-0.6.3/lib/rautomation/adapter/ 
 win_ffi/keystroke_converter.rb:9:in
 `convert'
 C:/Ruby/lib/ruby/gems/1.9.1/gems/rautomation-0.6.3/lib/rautomation/adapter/ 
 win_ffi/window.rb:118:in
 `send_keys'
 C:/Ruby/lib/ruby/gems/1.9.1/gems/rautomation-0.6.3/lib/rautomation/window.r 
 b:184:in
 `send_keys'
 C:/Ruby/lib/ruby/gems/1.9.1/gems/watir-1.9.2/lib/watir/ie-class.rb:478:in 
 `send_keys'
 M:/Users/DK/Projects/RAP/WorkingCopy/features/support/env.rb:147:in `After'

 I tried both Ruby 1.8 and Ruby 1.9. In 1.8 I'm getting a slightly
 different error:

 private method `split' called for 44:Fixnum (NoMethodError)
 C:/Ruby/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/adapter/wi 
 n_ffi/keystroke_converter.rb:9:in
 `convert'
 C:/Ruby/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/adapter/wi 
 n_ffi/window.rb:118:in
 `send_keys'
 C:/Ruby/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/window.rb: 
 184:in
 `send_keys'
 C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.9.2/lib/watir/ie-class.rb:478:in
 `send_keys'
 M:/Users/DK/Projects/RAP/WorkingCopy/features/support/env.rb:147:in `After'

 Is it a known problem?

 --
 DK
 AIM: DKroot1, Skype: DKroot

-- 
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] Re: send_keys broke in Watir 1.9.2/rautomation 0.6.3

2011-08-02 Thread Dmitriy Korobskiy

On 8/2/11 9:17 AM, Jarmo Pertman wrote:

#send_keys accepts now only strings. It accepted accidentally array of
VK_ codes in some previous version of RAutomation. Use better
solutions to capture screenshots. win32screenshot gem can help you
there https://rubygems.org/gems/win32screenshot and
https://github.com/jarmo/win32screenshot

Just `gem install win32screenshot` and start hacking :)

Jarmo

Thanks, Jarmo, I switched, and it helped to shrink code quite a bit.

One non-critical annoyance was mini-magick chocking on every space in 
the filename. Nobody likes spaces in filenames, of course :)

It was not critical; screenshots were still taken:

  Magick: unable to open image 
`C:/Users/DK/AppData/Local/Temp/Scenario\': No such file or directory @ 
error/blob.c/OpenBlob

/2584.
  Magick: no decode delegate for this image format 
`C:/Users/DK/AppData/Local/Temp/Scenario\' @ error/constitute.c/ReadImage

/532.
  Magick: unable to open image `'Delete\': Invalid argument @ 
error/blob.c/OpenBlob/2584.
  Magick: no decode delegate for this image format `'Delete\' @ 
error/constitute.c/ReadImage/532.
  Magick: unable to open image `cart'\': Invalid argument @ 
error/blob.c/OpenBlob/2584.
  Magick: no decode delegate for this image format `cart'\' @ 
error/constitute.c/ReadImage/532.
  Magick: unable to open image `failed\': Invalid argument @ 
error/blob.c/OpenBlob/2584.
  Magick: no decode delegate for this image format `failed\' @ 
error/constitute.c/ReadImage/532.
  Magick: unable to open image `@\': Invalid argument @ 
error/blob.c/OpenBlob/2584.
  Magick: no decode delegate for this image format `@\' @ 
error/constitute.c/ReadImage/532.
  Magick: unable to open image `2011-08-02\': Invalid argument @ 
error/blob.c/OpenBlob/2584.
  Magick: no decode delegate for this image format `2011-08-02\' @ 
error/constitute.c/ReadImage/532.
  Magick: unable to open image `121909.png': No such file or 
directory @ error/blob.c/OpenBlob/2584.
  Magick: unable to open file `121909.png' @ 
error/png.c/ReadPNGImage/3084.

   (MiniMagick::Invalid)
  
C:/Ruby/lib/ruby/gems/1.9.1/gems/mini_magick-3.2.1/lib/mini_magick.rb:388:in 
`run'
  
C:/Ruby/lib/ruby/gems/1.9.1/gems/mini_magick-3.2.1/lib/mini_magick.rb:374:in 
`run_command'
  
C:/Ruby/lib/ruby/gems/1.9.1/gems/mini_magick-3.2.1/lib/mini_magick.rb:293:in 
`write'
  
C:/Ruby/lib/ruby/gems/1.9.1/gems/win32screenshot-1.0.4/lib/win32/screenshot/image.rb:38:in 
`write'
  
M:/Users/DK/Projects/RAP/WorkingCopy/features/support/env.rb:158:in `After'


After I got rid of all spaces, it worked great.

The code of Cucumber hook if anybody needs it is the following. This 
works for both watir-webdriver and watir:


require 'tmpdir'

# run after the last step of each scenario, even when there are failing, 
undefined, pending or skipped steps.

After do |scenario|
  if scenario.failed?
# Take screenshot
screenshot_filename = File.join(Dir.tmpdir, Scenario_' + 
scenario.name.gsub(/[\/\\?*:| ]/, _) +

'_failed_@_ + Time.now.strftime(%Y-%m-%d_%H%M%S)) + .png
if defined?(browser.driver)
  browser.driver.save_screenshot(screenshot_filename)
  #embed(screenshot.png, image/png)
elsif ENV[BROWSER] == 'IE'
  require 'win32/screenshot'
  browser.maximize
  # Take a screenshot of the window with the specified handle
  Win32::Screenshot::Take.of(:window, :hwnd = 
browser.hwnd).write(screenshot_filename)

end
 end
end

--
DK
AIM: DKroot1, Skype: DKroot

--
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] Entering XML in textarea

2011-08-02 Thread Trevor
watir version = 1.9.2
ruby version = 1.8.7

Hi,
I need to read XML from a document and put it into a textarea.
I use REXML to read the file, but when I try to dump this into the
textarea I get an error and the field shows [object]

eg
file = File.new( C:/canoe1.xml )
doc = Document.new file
#   puts doc
$browser.text_field(:id, NewAEPGrid_ctl02_CoDFBox2).set(doc)

If I uncomment the puts doc, I can see that the XML is being read
into doc.

If I change the .set(doc) to e.g. .set(test) then the word test is
written OK into the field with no error.

The error I see is:
NoMethodError: undefined method `value' for UNDEFINED ... /
:REXML::Document
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.9.1/lib/watir/
input_elements.rb:382:in `method_missing'
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.9.1/lib/watir/
input_elements.rb:382:in `set'
C:/WATIR/CanoeETVScheduler/xml_test.rb:29:in `test01_NewAEP'

Is what I am trying to do actually possible or do I need to
investigate other options (the only similar post I found seemed to
suggest using cut'n'paste from an editor)

Thanks

-- 
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] Re: Object no longer attached to the DOM error on doing a exists call

2011-08-02 Thread Jari Bakken
Den 2. aug. 2011 kl. 14:19 skrev Alister Scott alister.sc...@gmail.com:


But, I understand the performance hit. Are we talking much slower execution
times?


I don't think locating elements is the major bottleneck in browser tests in
general, but it certainly can be in some cases. This is especially true with
WebDriver, where every call to the API is also an RPC. We won't know until
we try, I guess - I can create a branch where we can experiment.

The problem is finding good benchmarks. The easiest choice would be to just
run watirspec, but it almost never re-uses Element objects, so the
performance hit will likely be lower than in a real world test suite. It's
also rare for the specs to do nested finds (e.g. browser.div.text_field),
which would also be affected negatively.

Jari

-- 
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] Entering XML in textarea

2011-08-02 Thread Željko Filipin
On Tue, Aug 2, 2011 at 5:56 PM, Trevor ti_ma...@btopenworld.com wrote:
file = File.new( C:/canoe1.xml )

Can you provide xml file, so we could try to reproduce the problem?

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

-- 
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] Entering XML in textarea

2011-08-02 Thread Charley Baker
Try setting value instead of set.

blah.value = doc

Cheers,

Charley



On Tue, Aug 2, 2011 at 4:03 PM, Željko Filipin 
zeljko.fili...@wa-research.ch wrote:

 On Tue, Aug 2, 2011 at 5:56 PM, Trevor ti_ma...@btopenworld.com wrote:
 file = File.new( C:/canoe1.xml )

 Can you provide xml file, so we could try to reproduce the problem?

 Željko
 --
 watir.com - community manager
 watir.com/book - author
 watirpodcast.com - host

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