HI,
I understood from here "http://groups.google.com/group/watir-general/
browse_thread/thread/1c45fdb7908ebd71" that i need to convert the
value to string.
Now the last letter of the string is typed twice, for ex:
If "human" is the text i have in my spread sheet and the script feeds
"humann" in the text field.
Have placed the code here. How i do stop the last letter being printed
twice...
require "rubygems"
require "watir"
require "roo"
module Basic
def value
oo=Openoffice.new("D:\\test.ods")
oo.default_sheet = "Sheet1"
$text = oo.cell(1,1)
$text = $text.to_s
end
def searchtext
$ie.text_field(:title, "Google Search").set($text)
end
Balbao
On Aug 4, 2:03 pm, balbao <[email protected]> wrote:
> I'm trying to pass a value from one function to function and I get the
> foll;error,
>
> ruby callingfile.rb
> ./classfile.rb:15: warning: don't put space before argument
> parentheses
> C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb:
> 370:in `value': wrong number of
> arguments (0 for 2) (ArgumentError)
> from C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> input_elements.rb:370:in
> `type_by_character'
> from C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> input_elements.rb:382:in
> `characters_in'
> from C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> input_elements.rb:368:in
> `type_by_character'
> from C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> input_elements.rb:334:in `set'
> from ./classfile.rb:16:in `search'
> from callingfile.rb:11
>
> >Exit code: 1
>
> I have two files; The relevant functions in one file and the sequence
> of execution in another file.
>
> The functions file
>
> require "rubygems"
> require "Watir"
> require "roo"
>
> module First
>
> def value (filename,sheet)
>
> oo = Openoffice.new(filename)
> oo.default_sheet = sheet
> $keyword = oo.cell(2,'A')
> end
>
> def search
>
> $ie.goto("www.google.com")
> $ie.text_field(:title,/Google/).set($keyword1)
> $ie.button(:value, /Google/).click
> end
>
> end
>
> The execution file
>
> require "rubygems"
> require "Watir"
> require "classfile"
> include First
>
> $ie = Watir::IE.new
> file = "D:\\Testlocation\\test.ods"
> sheet = "Testsheet"
> value( file,sheet)
> search
>
> But when I club this into a single file, the test pass through. The
> value in the excel sheet is a “string”.
>
> Couldn't understand why I get this error in first place? If this has
> got to do with syntax or programmatic aberration, I expect the same
> error to be thrown while going with one file. But that doesn't seem to
> be so.
>
> Balbao
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---