Bret
I have been trying to get xpath to work in my scripts but have not been able to do so.
I have the latest from trunk (Version "$Revision: 934 is what it says in the watir.rb file) and ruby 1.8.4-16 and whatever REXML comes with that.
Here is the error I am getting:
1) Error:
test0_originator(TC_PER):
NoMethodError: undefined method `root_node' for <UNDEFINED> ... </>:REXML::Document
c:/ruby/lib/ruby/1.8/rexml/xpath_parser.rb:148:in `expr'
c:/ruby/lib/ruby/1.8/rexml/xpath_parser.rb:125:in `match'
c:/ruby/lib/ruby/1.8/rexml/xpath_parser.rb:56:in `parse'
c:/ruby/lib/ruby/1.8/rexml/xpath.rb:53:in `each'
c:/ruby/lib/ruby/1.8/rexml/element.rb:916:in `each'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1927:in `elements_by_xpath'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1917:in `element_by_xpath'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3255:in `locate'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2105:in `assert_exists'
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3546:in `set'
C:/watir_bonus/working/PER/tc_PER_Significant.rb:19:in `test0_originator'
exit
c:/ruby/lib/ruby/1.8/test/unit.rb:285:in `exit'
c:/ruby/lib/ruby/1.8/test/unit.rb:285
C:/watir_bonus/working/PER/tc_PER_Significant.rb:15
Here is my test script:
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'C:\watir_bonus\unitTests\setup'
class TC_xpath_test < Test::Unit::TestCase
include Watir
def gotoPopUpPage()
$ie.goto("C:\\watir_bonus\\working\\test.html")
$ie.set_fast_speed()
end
def test0_textfield
$d = Time.now.strftime("%m/%d/%Y")
gotoPopUpPage()
$ie.text_field(:xpath , "//[EMAIL PROTECTED]'beforetest']/").set("#{ $d }")
end
end
Here is the test html:
<html>
<head>
<title>
Test page for Text Fields
</title>
</head>
<body>
These text fields are used to test :beforeText and :afterText
<br>
<input type = text name = beforetest value = 'Before Text Test'>This Text After
<br>
This Text Before<input type = text name=aftertest value = 'AfterText Test' title = "This used to test :afterText">
<br>
<br>
</body>
</html>
Is there something I am missing? The xpath stuff runs in the unittests.
____________________
Mark L. Cain
LMIT - E *STARS ® ~ Lead Test Engineer
1981 Snyder, MSIN: G3-62, Richland, WA 99354
[EMAIL PROTECTED]
509.376.5458
"640 Kilobytes of computer memory ought to be enough for anybody." - Bill Gates, 1981
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
