ParseException met when using Watir with xpath, please help

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,"//input[@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!

We are now using a different xml parser for Watir (Nokigiri instead of
Rexml). You might want to build from trunk (master) or else wait for our
next release (which should be soon, but who knows?)

Bret

On Tue, Aug 4, 2009 at 8:40 PM, Gong J. [email protected]
wrote:

elements_by_xpath' D:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:49:inset’


Bret P.
Lead Developer, Watir, www.watir.com

Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Thank you very much for your reply, maybe I would try Nokigiri(What does
this word stand for?), for further learning or more progress on my
automation…
nevertheless, how could I build from trunk as you just said?

Yours,
Jaqueline

Bret P. wrote:

We are now using a different xml parser for Watir (Nokigiri instead of
Rexml). You might want to build from trunk (master) or else wait for our
next release (which should be soon, but who knows?)

Bret

Hi Bret,

I just begin to try Nokogiri1.3.3 now, it works fine for g.cn ^^
bravo~~~. And it really speed up my scripts, hope the next release for
Watir will come soon ^
^

Thanks,
Jacqueline

Bret P. wrote:

We are now using a different xml parser for Watir (Nokigiri instead of
Rexml). You might want to build from trunk (master) or else wait for our
next release (which should be soon, but who knows?)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs