I have a bunch of scenarios where I am creating automation that opens the browser, logs in and then clicks a specific link lets call these steps 1 to 3. then a series of different variations and checks depending on the links selected. lets call these steps 4 to 6 then I have a final few steps called steps 7 to 10. Steps 1 to 3 and steps 7 to 10 are the same. steps 4 to 6 are different, any suggestions how to handle it. I create a workflow of each of them but when I create steps 4 to 6 it wants to open a new browser to click the link needed in step 4. looking for suggestions to be more reusable
Hello,
To make your automation more reusable and avoid opening a new browser every time, you can try this simple approach,
1. Create Reusable Workflows,
a. Steps 1-3 (As per your requirement Common Steps): Create a workflow (OpenAndLogin.xaml) to open the browser, log in, and click the first link. Use arguments to pass values like URLs or credentials.
b. Steps 4-6 (I would suggest Variable Actions): Create separate workflows for each variation in steps 4-6 (e.g., ActionSet1.xaml, ActionSet2.xaml). These workflows should use the already opened browser by attaching to it.
c. Steps 7-10 (As per your requirement Common Steps): Create another workflow (FinalSteps.xaml) to handle the common final steps.
2. Main Workflow,
a. In your main workflow, call OpenAndLogin.xaml to open the browser.
b. Use a Switch activity to choose which set of actions (steps 4-6) to perform based on the scenario.
c. After the variable steps, call FinalSteps.xaml to complete the process.
Reuse the Browser
Use the Attach Browser activity in steps 4-6 and 7-10 to work within the same browser session, avoiding the need to open a new one.
This structure ensures that you only open the browser once.
Let me know if this helps your development.
Cheers!
Hello @vtonelli
If you are reusing the workflows within the same project, then I would create separate workflow-files (.xaml files) with arguments as needed - for example the URL you want to navigate to (in-arg) and the UiElement of the browser (out-arg).
If you want to reuse the workflows through several projects, then I would create a library for the purpose.
Here you can develop complete sections of code that you can publish and reuse as activities in your processes.
Regards
Soren