History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WTR-80
Type: Bug Bug
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Major Major
Assignee: Bret Pettichord
Reporter: Bach Le
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Watir

Selecting element by specifying form object does not work

Created: 07/Aug/06 06:22 PM   Updated: 14/Oct/08 03:54 PM
Component/s: HTML Controls
Affects Version/s: 1.5.0/1.5.1
Fix Version/s: 1.6.0

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: 1. HTML File entertainment_com.html (50 kb)

Environment: Win 2k Home Edition. Watir 1.5.1.1054. Ruby 1.8.2


 Description  « Hide
Use the following Watir Code to demonstrate this problem.

ie = IE.new
ie.goto("www.entertainment.com")
ie.link(:text, 'Buy the Book').click
ie.link(:text, 'Chicago North (2007)').click
ie.image(:index, '4').click
ie.button(:name, 'checkout').click
ie.form(:name, 'shipaddress').button(:src, 'https://www.entertainment.com/images/button_continue.gif').click

The above code works in Watir 1.4.1 but errors on the last line in 1.5.1.1054 with the following error message:

1) Error:
test_1(TestCase):
Watir::Exception::UnknownObjectException: Unable to locate object, using src and https://www.entertainment.com/images/button_continue.gif
    c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1054/./watir.rb:2267:in `assert_exists'
    c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1054/./watir.rb:2405:in `click'
    test.rb:15:in `test_1'


It will work, however, if I remove the form(:name, 'shipaddress') from the last line from the above watir code and instead used ie.button(:src, 'https://www.entertainment.com/images/button_continue.gif').click


 All   Comments   Work Log   Change History      Sort Order:
Bach Le - 07/Aug/06 06:29 PM
I misstated my working environment. The OS is Win xp home edition.

Bret Pettichord - 19/Sep/06 10:41 PM
Yikes!

Bret Pettichord - 28/Sep/06 10:58 PM
I reproduced this once, but know cannot reproduce it again with either version of Watir.

My problem is that i am getting an error with this line:
ie.link(:text, 'Chicago North (2007)').click

I think the first time the script runs, it changes the state of the site, so it can't be run again. It's also possible the web site has changed.

Would it be possible to provide a different web site or a modified script?

Our unit tests for forms work. Ideally we would be provided with a web page and a script that works with it.

Bret

Bret Pettichord - 28/Sep/06 11:08 PM
I now see the problem and can reproduce...

Bret Pettichord - 29/Sep/06 12:01 AM
This is the test case i used with this

class TC_Forms1 < Test::Unit::TestCase
  def setup
    puts Watir::IE::VERSION
    $ie.goto($htmlRoot + "entertainment_com.html")
  end
  def test_button_in_form
    assert_nothing_raised do
      $ie.form(:name, 'shipaddress').button(:src, 'https://www.entertainment.com/images/button_continue.gif').click
    end
  end
end

Bret Pettichord - 29/Sep/06 12:03 AM
I have attached a testcase and a html page that reproduce the reported problem. However, this testcase fails on both 1.5 and 1.4. I haven't looked at the html closely, so i don't yet know whether this is a bug or not.

However, i am no longer treating this as a regression bug.

Bret Pettichord - 29/Sep/06 12:03 AM
Downgrading because i have not been able to reproduce an example of this problem that only happens with 1.5.

Bach Le - 02/Oct/06 11:35 AM
I will see if I can set up a website you can use to verify this problem.

Bret Pettichord - 18/Oct/06 06:54 PM
From Phlip:

1.5.1.1065

My test suite is checked into the HEAD here, if you want to tweak its
forms cases:

http://rubyforge.org/projects/minirubywiki/

Bret Pettichord - 14/Oct/08 03:54 PM
I've added a testcase for this issue and have a fix, but the fix breaks another test. The issue in the end is whether we use the "all" or "elements" method of the form to get the descending element. We have been using "elements" and until this example, it worked. Using "all" also usually works, except for one test that we have (google-india).

If you want to fix this, use this code. But I want to understand more about this before commiting this to trunk.

class Watir::Form
    def ole_inner_elements
      assert_exists
      @ole_object.all
    end
end