Logging into the same site but with different users each time

Hi,

I have created a bot which logs into a website and downloads a particular file to excel.

Now I need to set up a loop for this, so it repeats this exact process, but each time it logs in using a different username.

From what I’ve looked up, I think I’ll need to use ‘for each loop’ to do this. However, I don’t know where to put the ‘for each loop’.

There are about 30 usernames (variables). Ideally, I want this as a list in excel, where the bot will take the values from the excel list. That way, if the list of usernames expands, the bot process remains the same.

Any help would be great,
Thank you
Claire

1 Like

Hi @clairemobbs

You need to put the For Each loop before the actions that need to be repeated, so in your case probably, before the Open website.

Before that, you can have the actions for the bot to read the usernames from an Excel file to a list.

image

1 Like

Hi @ashapkina

Thanks for the quick response.

I have placed the ‘for each loop’ in the sequence, but it’s not it’s own action. It is nested under ‘get column a’. Instead of entering each username in the website, it enters the entire list into the website, which doesn’t work.

I have tried putting the actions from ‘open website’ and below to be nested under ‘for each’ but it won’t let me.

See below workflow.

image

Can you help?
Claire

The structure of your recording is a bit incorrect.

You need to to remove the Fore Each loop from under the Open spreadsheet and nest Open website and all other actions that need to be repeated in the loop inside it. like on my screenshot above.

1 Like

Thank you very much. I have restructured and the loop is working.

One issue I am having is with mouse clicks. They don’t always work, and it seems to be a different mouse click not working each time I try. When I look at the error description, it seems to be due to a timeout exception. As you’ll see from my structure below, I have put in various ‘wait’ actions to try and avoid timeouts. Can you help?

Kind regards
Claire

Try replacing wait actions with timeout in the mouse click actions themselves

image

Thank you. It is working most of the time. Sometimes it will still timeout however.

The loop is now working for the first set of credentials, however it is not working for the 2nd loop. I get the below alert on chrome when the loop attempts to login to the 2nd site (2nd loop):

image

Here is my actions flow:

Here is the error message in Workfusion:

I have tried placing in actions at the end of the loop to log out & close the browser, but it doesn’t work that way either. If I put the log out & close window actions in, I get the error message ‘chrome not reachable’.

Can you please assist?
Thank you
Claire

If you close the browser and then open it again, it will result in this error.

Try leaving the actions to log out of the current user, but remove the actions that close the browser.

I have tried just having an action to log out, but it still doesn’t work. When it gets to the point in the loop where the new credentials are entered, I get the error message per before ‘this browser instance is still connected to a different site’.

Below is detail from workfusion error message:

Is it possible that the logout action isn’t working? I thought that if it didn’t work, then the bot would stop. But the bot is not stopping at the ‘click log out’ action. I had great difficulty getting the bot to click on the log out button. Web element didn’t work (using Xpath), image didn’t work, only by selecting the position of the log out button would it seem to work.

I even set up a ‘wait for image’ action after the click on logout action so that the bot waits until it logs out.

image

Could you please help?
Claire