Copying the file in local hard drive to the text field in th

In my previous inquiry, I have received the below suggestion; I was
inquiring how I can copy a file in my hard drive to the text field in
the web.

Yes, below code works!!! but each file I need to upload is quite
lengthy, and I have many hundreds of them.

When I run the code below, WATIR is reading the file in my hard drive a
character by character into the text field in the web; it simply takes
too long.

Is there anyway I can copy the file in my hard drive in its entirety
all at once, and paste it to the text field in the web at once?? That
way I do not have to wait till the code reads a character by
character… and the job will be done much faster…

any suggestion or help will be deeply appreciated.

thanks.

m.

Well, what you’re doing is just taking the contents of the variable
$Path and setting it to the text field. You’ll actually need to open
and read the file. For example…

ie.text_field(:name, “html_text”).set(File.new($Path).read)

That should do it.

M.T.

ie.text_field(:name, “html_text”).value = File.new($Path).read

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs