Sha256: f429578adc0bdd7fbb4fa3b8405fb624677fb7d435fe5da4696313a2bf91b183

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# feature tests for attaching to existing IE windows
# revision: $Revision: 1.8 $

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'unittests/setup'

class TC_ExistingWindow< Test::Unit::TestCase
    include Watir

    def goto_page(page)
      $ie.goto($htmlRoot + page)
    end

    def test_ExistingWindow
       goto_page 'buttons1.html'
       ie3=nil

       assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:title , "missing") }
       assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:title , /missing/) }

       assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:url , "missing") }
       assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:url , /missing/) }

       ie3 = IE.attach(:title , /buttons/i )
       assert_equal( "Test page for buttons" , ie3.title)
       ie3=nil

       ie3 = IE.attach(:title , "Test page for buttons" )
       assert_equal( "Test page for buttons" , ie3.title)
       ie3=nil

       ie3 = IE.attach(:url, /buttons1.html/ )
       assert_equal( "Test page for buttons" , ie3.title)
       ie3=nil

       #hard to test :url with explicit text
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-1.4.1 unittests/attachToExistingWindow_test.rb