First of all - sorry about the subject. I was unable to think of any
better subject for this problem.

Anyway, problem is simple - checkbox and radio methods are not working
on some circumstances.

I have used with Watir for quite a long time all of this extracted
code, which I've put into this FirewatirBroken class for reproducing
the problem. Code itself should be quite self explanatory. Here it is:

<code>
require 'watir'

class FirewatirBroken

  def initialize
    Watir::Browser.default = "firefox"

    @browser = Watir::Browser.new
    @browser.goto "http://www.google.com";

    locator = "btnG"

    e = first_existing_element(
      text_field(locator),
      #checkbox(locator),
      button(locator)
      #radio(locator)
    )

    p e
  end

  def first_existing_element(*items)
    for element in items
      begin
        return element if element.exists?
      rescue
      end
    end
    element
  end

  def text_field locator
    first_existing_element(
      @browser.text_field(:name, locator),
      @browser.text_field(:id, locator)
    )
  end

  def button locator
    first_existing_element(
      @browser.button(:name, locator),
      @browser.button(:id, locator)
    )
  end

  def radio(locator, value=nil)
    first_existing_element(
      @browser.radio(:id, locator, value),
      @browser.radio(:name, locator, value)
    )
  end

  def checkbox(locator)
    first_existing_element(
      @browser.checkbox(:name, locator),
      @browser.checkbox(:id, locator)
    )
  end

end

FirewatirBroken.new
</code>

What should be outputted on that line in initialize, where i'm p-ng e?

This should happen:
name:         btnG
type:         submit
id:
value:        Google Search
disabled:     false

But instead, this will be outputted:
name:         TypeError: elements_input[51] has no properties
type:         TypeError: elements_input[51] has no properties
id:           TypeError: elements_input[51] has no properties
value:        TypeError: elements_input[51] has no properties
disabled:     TypeError: elements_input[51] has no properties

As soon as you comment radio and checkbox out (and remove that extra
comma), then you'll get the expected results. But as soon as you
comment at least one of them in again, this error will be outputted.
As I've stated before, all of this code works just fine under Watir.

It also worked fine with any other element I tried to have there.
Anyway, there seems to be some bug. It's kinda sad (and bad) that
problems with Firewatir aren't so obvious, because usually no useful
stacktrace won't be printed due to the fact that these problems come
from the jssh itself (at least I think so).

I'm using Watir/Firewatir 1.6.2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to