0

我正在尝试将数组中的数据输入网站,但是出现错误。我相信错误意味着我不能将浮点数放入文本字​​段,所以我将浮点数更改为字符串。但它又没有用。我只包含了我认为相关的代码部分。

块引用

eee = Watir::Browser.new 

    eee.goto(fulllink)
    eee.text_field(:name => "txtAttr").set Headings[j]
    eee.wait
    p = j + 1 
    strings = body.at(0).at(p)
    String (strings)
    eee.text_field(:name => "txtValue").set strings
    eee.wait
    eee.link(:index => 4).click 
    eee.wait
    eee.close
    end 
    i += 1 


C:\Users\Pure.itloaner1-12\Google Drive\ruby>ruby ExST.rb
hello world
Alpha Numeric Unit #
tables filled
200.0
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/input_
elements.rb:356:in `characters_in': undefined method `each_char' for 200.0:Float
 (NoMethodError)
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-c
lassic/input_elements.rb:337:in `type_by_character'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-c
lassic/input_elements.rb:299:in `set'
        from ExST.rb:92:in `<main>'
4

1 回答 1

0

尝试是否更改String(strings)strings = String(strings)有效。

于 2012-06-05T19:19:24.147 回答