
| Key: |
WTR-217
|
| Type: |
Bug
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Hugh
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
Watir
Created: 05/Jun/08 10:04 PM
Updated: 27/Oct/08 12:47 PM
|
|
| Component/s: |
HTML Controls
|
| Affects Version/s: |
1.5.4
|
| Fix Version/s: |
1.6.0
|
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
Environment:
|
Windows XP, Ruby 1.8.6, watir 1.5.4
|
|
|
if you attempt to locate a checkbox with ie.checkbox(:ole_object, ole_reference), it fails with a WIN32OLE error (see irb below). This happens with any checkbox you try to access this way. As far as I have seen, other html elements seem to work fine.
Adding this seems to provide a workaround
class WIN32OLE
def matches(x)
return self.outerHTML == x.outerHTML
end
end
Sample HTML
-------------------------------
<html><title>OLE Checkbox</title></html>
<input name="firstname" type="text">
<input type="checkbox" name="sports" value="soccer" />
Locating a checkbox using :ole_object
----------------------------------------------
irb(main):007:0> ole = ie.checkboxes[1].locate
=> #<WIN32OLE:0x34c34f4>
irb(main):008:0> ie.checkbox(:ole_object, ole).flash
WIN32OLERuntimeError: unknown property or method `matches'
HRESULT error code:0x80020006
Unknown name.
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:111:i
n `method_missing'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:111:i
n `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:98:in
`each'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:98:in
`locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/container.rb:823
:in `locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/input_elements.r
b:464:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/element.rb:47:in
`assert_exists'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/element.rb:236:i
n `flash'
from (irb):8
For a text field, the same methodology works fine...
----------------------------------------------
irb(main):010:0> ole = ie.text_fields[1].locate
=> #<WIN32OLE:0x34b6240>
irb(main):011:0> ie.text_field(:ole_object, ole).flash
=> nil
(the element flashes)
Then you can work around the issue
-----------------------------------------------
irb(main):010:0> class WIN32OLE
irb(main):011:1> def matches(x)
irb(main):012:2> return self.outerHTML == x.outerHTML
irb(main):013:2> end
irb(main):014:1> end
=> nil
irb(main):015:0> ie.checkbox(:ole_object, ole).flash
=> nil
(the element flashes)
|
|
Description
|
if you attempt to locate a checkbox with ie.checkbox(:ole_object, ole_reference), it fails with a WIN32OLE error (see irb below). This happens with any checkbox you try to access this way. As far as I have seen, other html elements seem to work fine.
Adding this seems to provide a workaround
class WIN32OLE
def matches(x)
return self.outerHTML == x.outerHTML
end
end
Sample HTML
-------------------------------
<html><title>OLE Checkbox</title></html>
<input name="firstname" type="text">
<input type="checkbox" name="sports" value="soccer" />
Locating a checkbox using :ole_object
----------------------------------------------
irb(main):007:0> ole = ie.checkboxes[1].locate
=> #<WIN32OLE:0x34c34f4>
irb(main):008:0> ie.checkbox(:ole_object, ole).flash
WIN32OLERuntimeError: unknown property or method `matches'
HRESULT error code:0x80020006
Unknown name.
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:111:i
n `method_missing'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:111:i
n `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:98:in
`each'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/locator.rb:98:in
`locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/container.rb:823
:in `locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/input_elements.r
b:464:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/element.rb:47:in
`assert_exists'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/element.rb:236:i
n `flash'
from (irb):8
For a text field, the same methodology works fine...
----------------------------------------------
irb(main):010:0> ole = ie.text_fields[1].locate
=> #<WIN32OLE:0x34b6240>
irb(main):011:0> ie.text_field(:ole_object, ole).flash
=> nil
(the element flashes)
Then you can work around the issue
-----------------------------------------------
irb(main):010:0> class WIN32OLE
irb(main):011:1> def matches(x)
irb(main):012:2> return self.outerHTML == x.outerHTML
irb(main):013:2> end
irb(main):014:1> end
=> nil
irb(main):015:0> ie.checkbox(:ole_object, ole).flash
=> nil
(the element flashes) |
Show » |
|