I currently have to do a job where I have to copy the code of a website into a textfield.
I'm using watir to do the browser handling. As far as I know, I can only fill the field using the set
function, which means that I have to do something like
browser.text_field(:id => "text").set sitetext
With sitetext
being the code of the website that I'm copying into it.
I've loaded the code from a file into an array before and then pushed it into the string (probably not the best choice, but easiest for me right now), using the following code.
contentArray=Array.new
inputFile=File.open("my-site.html")
inputFile.each{|line| contentArray<<line}
inputFile.close
Now when I execute the first command to fill in the text_field, it slowly types in all the letters (is there an easy way to speed this up?), but after 692 characters it stops in the middle of the sentence. [I pasted the text that was entered into charcounter.com, that's how I know this number.]
Where is the problem? Is ruby giving my strings a limited size for some reason? Can I somehow lift this barrier?
Is there another way to fill the text_field?