4

I am using Fake to automate some web tasks.

I have a CSV file on disk that contains rows of data which I'd like to use to fill out forms in my Fake Workflow.

How can I iterate thru the rows in the CSV file and access the values found in each column in my Fake Workflow?

1 Answer 1

5

The best approach is to use the Repeat With Action with the lines in file option selected. This allows you to read the CVS file on disk and iterate thru the rows as Fake Variables. You can then access these Fake Variables in other Actions which can fill out the web form (or whatever you need).

enter image description here

As seen in the screenshot above, I'm using a Do JavaScript action to initially fetch the current line Variable and then split it into an array of comma separated values.

var line = fake.get('line');

Then I use Fake's JavaScript API to set individual variables for each column:

var row = line.split(',');
fake.set('first', row[0]);
fake.set('last', row[1]);

Then use other Fake Actions to work with the data you've fetched. In this case, I'll fill out a simple web form using the Set Value of HTML Element Action. In this Action's text fields you can access Fake Variables with this special syntax:

${first}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .