关于watir-webdriver中文乱码问题

 

require 'watir-webdriver'
require 'iconv'  
cov = Iconv.new( 'gbk', 'utf-8')     

b = Watir::Browser.new 


b.cookies.clear

b.goto("http://www.hao123.com")
  

#t = b.text_field :class => 'input input-hook'
#t.exists?
#t.set 'your name'
#t.value



a=b.button(:class=>'button button-hook').attribute_value("value")
 
puts cov.iconv("#{a}")

puts b.link(:xpath=>'//*[@id="__wgt_0_28"]/li[4]/span[4]/a').text()

#b.span(:xpath=>'//*[@id="hao123-footer"]/div[1]/span[5]').flash

#puts b.span(:class=>"g-fc2 copyright").text



#attribute_value("value")

#puts #{a}
#
#a.flash
#t.set 'ddd'

 

你可能感兴趣的:(webdriver)