Hello! I want to create a process where, if logging into a website with specific credentials listed in an Excel file fails, it will proceed to the next row in the Excel file and attempt to log in with the new credentials. I am unsure which activities to use. I tried using the “Break” activity, but it terminated the entire loop. Any suggestions?
Excel Application Scope
Read Range ("Sheet1", "A1:B10", dtCredentials)
For Each Row in dtCredentials
Assign username = currentRow("Username").ToString
Assign password = currentRow("Password").ToString
Type Into (username field, username)
Type Into (password field, password)
Click (login button)
Element Exists (dashboard element, loginSuccess)
If loginSuccess
Break
Else
Continue
Can you let me know where should I put this? I am new to this ![]()
For each row in datatable
Try Catch
Give Credentials using Type into Activity Username,Password,Click
Use Check app state activity or Element Exist
If Successfully logged in —>Use Break
else
Log Message: “Login failed, moving to next row”
Catch:
Exception (if any activity fails inside Try)
Log Message: “Exception occurred, moving to next row”
Hmmm…Not quite right. If the login is successful, there are several activities to perform within the profile. If the login fails, we need to use the credentials from the next row in the Excel file to try again. Also, I believe “Element Exists” is not the most suitable activity since it takes a long time to determine if the element exists. I really prefer the “Check App State” activity.
What I need is 2 “For Each Row In Data Table” activities, since “Break” goes out from first possible “For Each Row In Data Table” activity!
All Login Credentials are stored in a excel and you have to go through each row and try to login, When the login fails due to wrong credentials then you want to go with credentials in the next row.
Check the below steps,
→ When login with wrong credentials it will show a message on the screen right.
→ Drag and drop a check app state activity and indicate the Message which shown in the Login Screen (Login Failed due to wrong credentials or something error message).
→ Inside the Target does not appear block insert the activities to do actions after successful Login.
→ Inside the Target Appear block insert the Navigate browser and select the Refresh option from dropdown. If Login failed then it will refresh the page.
Credential Failed Screnario - By doing this If one row credentials fails the check app state will capture the Error message and execute the Target Appear block we have inserted Navigate browser to just refresh page. Then the bot will go to Next iteration by bringing new credentials.
Login Success Scenario - If the Credentials are correct the Error message will not displayed and bot will execute the Target does not appear block we inserted the Activites if login got success then this execute. After executing all this the bot will go to Next iteration.
Hope it helps!!
Check the below workflow, this may helpful for your understanding… @Chris_Balance
Hope you understand!!
First off, don’t put the Use App/Browser inside the loop. Put the loop inside the Use App/Browser. At the beginning you can just navigate the browser to the URL with the Go To URL activity. Closing and reopening the browser over and over is asking for problems.
The Break will exit the loop. That’s not what you want. If you’re trying do a “do these things if it appears” and just want to skip to the next record in the loop if it doesn’t appear, then just put ALL the steps inside the Target Appears section and leave the does not appear section empty.
Instead of brak use continue
And on then side use break as the login is successful
Cheers
Perfect! Thank you! ![]()
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.


