/ / Vkladanie vločiek do textového poľa Watirs - rubín, watir

Imputing flooty do textového poľa Watirs - ruby, watir

Snažím sa pripísať údaje z poľa dowebové stránky, ale dostávam chybu. Verím, že chyba znamená, že nemôžem dať riadky do textových polí, takže som zmenil povlak na reťazec. Ale opäť to nefungovalo. Zahrnul som iba tú časť kódu, ktorú som považoval za relevantnú.

blockquote

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:UsersPure.itloaner1-12Google Driveruby>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>"

odpovede:

0 pre odpoveď č. 1

skúste zmeniť String(strings) na strings = String(strings) funguje.