ParseException met when using Watir with xpath, please help.

G

Gong Jing

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!
 
B

Bret Pettichord

[Note: parts of this message were removed to make it a legal post.]

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 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!


--
Bret Pettichord
Lead Developer, Watir, www.watir.com

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

jacqueline gong

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
 
J

jacqueline gong

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,928
Messages
2,570,068
Members
46,513
Latest member
JacklynMcC

Latest Threads

Top