place following in the begin of your scripts: require "win32ole" WIN32OLE.codepage = WIN32OLE::CP_UTF8
pleas refer to myblog: http://www.sdgz.cn/watirzai-zhong-wen-huan-jing-xia-shi-yong-xpathde-yi-ge-zhu-yi-shi-xiang/ On 11月18日, 下午12时51分, Capricorn <qian...@ecitysky.com> wrote: > Hi all, > I'm new here, and I met some problem while I was using Watir gem to > automate my testcase. > I want to use Watir with xpath, coding like this: > > require "watir" > > @ie = Watir::IE.new > @ie.goto("www.g.cn")#google in china > @ie.text_field(:xpath,"//inp...@name='q']").set 'test' > > And there comes the following exceptions: > D:/ruby/lib/ruby/1.8/rexml/parsers/treeparser.rb:90:in `parse': > #<REXML::ParseException: Missing end tag for 'u' (got "a") > (REXML::ParseException) > > Line: > > Position: > > Last 80 unconsumed characters: > > <a class="gb3" style="COLOR: green! important" onclick="gbar.qs > (this)" > href="ht> > > D:/ruby/lib/ruby/1.8/rexml/parsers/baseparser.rb:320:in `pull' > > D:/ruby/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse' > > D:/ruby/lib/ruby/1.8/rexml/document.rb:190:in `build' > > D:/ruby/lib/ruby/1.8/rexml/document.rb:45:in `initialize' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > 713:in > `new' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > 713:in > `create_rexml_document_object' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > 693:in > `rexml_document_object' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > 897:in > `elements_by_xpath' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > 890:in > `element_by_xpath' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/container.rb: > 730:in > `locate_input_element' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb: > 5:in > `locate' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:49:in > `assert_exists' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:284:in > `enabled?' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:56:in > `assert_enabled' > > D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb: > 323:in > `set' > > D:/zhilan/tbtest_trunk/tbautotest/product/mytest/new_main.rb:24 > > Then I changed to ebay site, everything went well. > Does this problem come out because there are double byte characters in > g.cn? Maybe it's a naive question, I've worked on this for sometime > but > still no progress,really hope someone will have solutions to this. > Many > thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---