Save (“Mock”) A Web Page in Certain State for Consistent Unit Testing

Hi UiPath Community,

currently, we have the following problem regarding Browser UI Automation & Testing.

Use Case:
The process input is a list of Order Numbers. Each Order Number refers to one specific electronic part (e.g. a microchip).

For each Order Number, the process should type in the number on a set amount of different web-pages (part-vendor websites). Once typed in, the according electronic part will be displayed and there are three options regarding the state of the part:

  • in stock
  • not in stock until (date)
  • not in stock

We need a way to consistently test our workflows. Meaning that, for example, with part number 1234, on web page, the result of the workflow must be “In Stock” (simple unit testing).

Now, the problem is that the state of the parts constantly changes. One minute the part is available, then after half an hour its out of stock. So there is no way for us to write a fixed set of test cases, because we cannot determine the current state of the part, and thus do not know what the correct result of the test case should be.

We thought about saving the web page when it is in a certain state (with “Save As → Web Page, Complete”), but on certain pages there are images missing, check boxes and input fields do not work, etc…

We’ve tried this approach with several web browsers (Firefox, Chrome, Edge).

Is there a way to save a web page when its in a certain state (“Mock” it if you wish), so that it contains every part of the page and also maintains its functionality, so it is properly accessible by the robot?

Or is there any other way how you would approach this problem?

Thank you in advance for the help!


Depending on some factors, but for initial development purpose we manipulated / edited the webpage manually to the values /state we needed by using the Browser F12 Webtools and then did run the part implementation against the manipulated page

Maybe you can automate the manipulation and define some unit test cases as well


Thanks for your quick response!

Did you save the page as a “.html” file, manipulated the page to fit the required state, and then ran the unit tests by opening this “.html” file in the browser instead of the actual web page?

The biggest problem with this approach is that on certain pages, input fields and check boxes would not work - would you manipulate the web page to restore the functionality in this case?

no we changed directly within the browser

Okay, i understand that this works during development. Did you also have a way for running consistent Unit Tests against a set of “saved” web pages in certain states?

We would need to run consistent Unit Tests within our CI/CD pipeline.

As mentioned it depends on details. Yes we had the luck to work against static files. But as you mentioned

but maybe there is a way to get it work. Also is depending on details. What is not working?

1 Like

We’ve been able to resolve the errors regarding check boxes and input fields.

Now only images and videos on the web pages are not able to load. But since we are not interacting with them, i guess that the prepped site we now have should suffice for unit tests.

Thanks for your suggestion!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.