Sha256: b434395fad98dd9a5b8c2eed3b4c74a35a0bf82e4a579b00fb98015fcaf236e5

Contents?: true

Size: 646 Bytes

Versions: 36

Compression:

Stored size: 646 Bytes

Contents

require 'test/unit'
require 'nokogiri'

class XPathTest < Test::Unit::TestCase
  def setup
    file = File.open( "xpath_bug.xml" )
    @doc = Nokogiri::HTML::Document.read_io(file, nil, nil, 2145)
  end
  def fixture xpath
    matches = []
    
    @doc.xpath(xpath).each() do |node|
    	matches << node
    	assert_equal('Add', node.text)
    	assert_equal('ButtonText', node['class'])
    end
    
    assert_equal(1, matches.length)
  end  
  def test_text
    fixture "//div[text()='Add' and @class='ButtonText']"
  end
  def test_contains
    fixture "//div[contains(.,'Add') and @class='ButtonText']"
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
watir-1.9.0.rc4 unittests/other/rexml_unit_test.rb
watir-1.9.0.rc3 unittests/other/rexml_unit_test.rb
watir-1.9.0.rc2 unittests/other/rexml_unit_test.rb
watir-1.9.0.rc1 unittests/other/rexml_unit_test.rb
watir-1.8.1 unittests/other/rexml_unit_test.rb
watir-1.8.1.rc1 unittests/other/rexml_unit_test.rb
watir-1.8.0 unittests/other/rexml_unit_test.rb
watir-1.8.0.rc1 unittests/other/rexml_unit_test.rb
watir-1.7.1 unittests/other/rexml_unit_test.rb
watir-1.7.0 unittests/other/rexml_unit_test.rb
watir-1.7.0.rc1 unittests/other/rexml_unit_test.rb
watir-1.6.7 unittests/other/rexml_unit_test.rb
watir-1.6.7.rc1 unittests/other/rexml_unit_test.rb
watir-1.6.6 unittests/other/rexml_unit_test.rb
watir-1.6.6.rc2 unittests/other/rexml_unit_test.rb
watir-1.6.6.rc1 unittests/other/rexml_unit_test.rb