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
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!
here its my code:
Watir::Browser.default = “firefox”
browser.text_field(:name, “tags”).set(“funny images”)