On 1 December 2012 13:14, calin simona <lists@ruby-forum.com> wrote:
> Hello everybody,
>
> I am somehow new in ruby&watir. All i want to do today its to fill a
> form, and 2 fields are taken from 2 different files.(urlimages.txt and
> title.txt) like you see in attACHMENT. After
> all fields are filled will be hit the "upload" button. After this, the
> 2 fields (url images and titles) will be again filled with second line
> from each file),press upload button,after this will be filled with 3th
> line from each file...and soo on till the end of file lenght,assuming
> that
> booth have the same numbers of lines.
>
> My tactic:i tried to open each file with file.open, after this:
> file.readlines() then make a loop to read each line of files and fill
> the fields, then click submit. BUT...because are 2 files i find hard to
> fill the form (source_title and image_url_input) without losing the
> readlines counter.I mean every time will be read first line of each
> file,i dont want this.
> What should i do? to create a global variable that will be the counter
> of lines from files? please help!
Can I clarify something? Which machine are the files on? The server
machine running Rails or the client PC running the browser?
Colin
>
>
>
>
>
> here its my code:
>
> require 'rubygems'
> require 'watir'
> Watir::Browser.default = "firefox"
> goto_url("http://www.imgfave.com/post")
> browser.text_field(:name,
> "source_title").set("_line_from_C\:\\title.txt")
> browser.text_field(:id,
> "image_url_input").set("_line_from_C\:\\urlimages.txt")
> browser.text_field(:name, "tags").set("funny images")
> browser.text_field(:name, "source_url").set("http://www.9gag.com")
> browser.button(:value,"Upload").click
>
> Attachments:
> http://www.ruby-forum.com/attachment/7916/watir.PNG
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment