Is there any way to reuse the same login steps with different users

I would like to know if there is any way to reuse the same steps (login steps) using different users

Ware logging with user1 and then we want to login with user2
Can we reuse the same code(steps) using another username and password?

Thanks in advance!

Yes you can use run command to reuse a macro code.

Or uses variables for the user name and password.

Using variables in Selenium IDE can be a great help when a manual test takes too long and there are values you want reuse within the test.

With the Selenium IDE command “store” you can specify a variable and its value to use later in the test case. This will allow you to create a variable and retrieve the value later or even in another test macro (see Selenium IDE global variables), as many times as you need.

Thank you for your answers @newuserkantu @ulrich

If I want to run this scenario:

run /reuse/login_macro
echo Now we are logged in!
run /reuse/logout_macro
run /reuse/login_macro

Is any way to run the same login macro with 2 different user data or I need to create two login macros login_user1 and login_user2?

This is certainly possible. How do you want to switch between user1 and 2? Via a dialog?

-Step 1: Login to website(desktop app) with user_1 [enter username password + clicking login button]
-Step 2: Logout via clicking logout button
Then login page is displayed again
-Step 3: Login to website(desktop app) with user_2 [enter username password + clicking login button]

Step one and three are the same (buttons, input fields)
One way is to use reuse login_macro but we are sending data for user1 or user2 via using csvRead or directly writing data, since we have here the credentials for one of users can not use it for the logging of the next user (probably I am missing something)