[wtr-general] Re: watir 2.0.1 table rows method broken

2011-08-27 Thread Jarmo Pertman
Fixed that bug in commit 
https://github.com/bret/watir/commit/3846b6f300f5210df6b196eeeb15684b6e25378b

Jarmo

On Aug 25, 5:13 am, Dmitriy Korobskiy dkro...@gmail.com wrote:
 On 8/24/11 9:48 PM, Alister Scott wrote:







  Yeah, it looks bust.
  You can use:

  browser.table(:id, 'administrators').each do |row|
    puts
    puts row.inspect
    puts row.text
  end

  which works, but isn't watir-webdriver compatible.

  Cheers,
  Alister

  --
  Before posting, please readhttp://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

 I ran into problems with it. I run quite a bit into differences in API
 between Watir and Watir-WebDriver (I use both simultaneously). I have
 monkey patches that fix the problems as I find them.
 Here is my current full set of patches in case you don't want to wait
 for the fix:

          # == Monkey patch Watir for better compatibility with
 Watir-WebDriver ==

          require 'watir/container'
          require 'watir/element'
          require 'watir/table'
          Watir::Table.class_eval do
            def rows
              result = []
              for row in self
                result  row
              end
              result
            end

            def strings
              result = []
              for r in 0..row_count-1
                result  row_values(r)
              end
              result
            end

            def ths
              rows[0]
            end
          end

          Watir::TableRow.class_eval do
            def size
              column_count
            end

            # Add strings method for easier assertions
            def strings
              to_a
            end
          end

          # == Monkey patch Watir-WebDriver for better compatibility
 with Watir ==

          Watir::TableRow.class_eval do
            def each
              for c in cells
                yield c
              end
            end

            def size
              cells.size
            end
          end

          # Add strings method for easier assertions
          Watir::ElementCollection.class_eval do
            def strings
              to_a.collect {|e| e.text} #.gsub(nbsp;,  ).squeeze(
 ).strip
            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] Re: watir 2.0.1 table rows method broken

2011-08-24 Thread Alister Scott
Yeah, it looks bust.
You can use:

browser.table(:id, 'administrators').each do |row| 
  puts 
  puts row.inspect 
  puts row.text 
end 

which works, but isn't watir-webdriver compatible.

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] Re: watir 2.0.1 table rows method broken

2011-08-24 Thread Dmitriy Korobskiy

On 8/24/11 9:48 PM, Alister Scott wrote:

Yeah, it looks bust.
You can use:

browser.table(:id, 'administrators').each do |row|
  puts
  puts row.inspect
  puts row.text
end

which works, but isn't watir-webdriver compatible.

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
I ran into problems with it. I run quite a bit into differences in API 
between Watir and Watir-WebDriver (I use both simultaneously). I have 
monkey patches that fix the problems as I find them.
Here is my current full set of patches in case you don't want to wait 
for the fix:


# == Monkey patch Watir for better compatibility with 
Watir-WebDriver ==


require 'watir/container'
require 'watir/element'
require 'watir/table'
Watir::Table.class_eval do
  def rows
result = []
for row in self
  result  row
end
result
  end

  def strings
result = []
for r in 0..row_count-1
  result  row_values(r)
end
result
  end

  def ths
rows[0]
  end
end

Watir::TableRow.class_eval do
  def size
column_count
  end

  # Add strings method for easier assertions
  def strings
to_a
  end
end

# == Monkey patch Watir-WebDriver for better compatibility 
with Watir ==


Watir::TableRow.class_eval do
  def each
for c in cells
  yield c
end
  end

  def size
cells.size
  end
end

# Add strings method for easier assertions
Watir::ElementCollection.class_eval do
  def strings
to_a.collect {|e| e.text} #.gsub(nbsp;,  ).squeeze( 
).strip

  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