Scenario: I have to read input from UI and based on the input i have to run my selenium script.

Earlier i prepared a jar file for the same and was inserting values for the script from excel and executing my selenium script

But now as an improvement i have to fetch the data from UI and based on the data execute the scripts

Can please someone help me doing so? Like which UI i can use and where to fetch data from and finally how to run the script?

  • Fetching test data from UI is slower, instead fetch it from backend by using queries or API calls. Jan 10, 2019 at 8:37

1 Answer 1


First of all you have to understand that UI stands for just an User Interface. So this is some way that allows a user to interact with your application (so, when you were interacting with your tests using Excel - Excel was a sort of User Interface that time). There are few ways which have their own advantages and disadvantages:

  1. Command Line Interface (a.k.a. CLI). There are two main advantages here: it is the most easiest interface to implement and it will run on the system without graphics environment (that basically means you will be able to run it in any command line processor). It also has a disadvantage: It does not allow you to well structure a user input.

  2. Desktop GUI. There are some pro's for this choice. It allows you to structure your input data for the user, use complex controls like combo-boxes, radio-buttons, etc, make user flow more representative. It also allows to integrate your GUI with the applications which are running within the same environment your GUI is. For example you can make your GUI app call your tests using the data a user has provided via the interface. There are some disadvantages. The main disadvantage is that it requires some programming skills which are beyond the basic ones. Since GUI apps require understanding of multi-threading conceptions and inter-threading communications.

  3. Web-GUI. Pro's: Web GUI unlike the desktop one is usually more standardized and probably a bit more easy for implementation. It also allows you to share your app for different users across the network. So several people would be able to provide data for your tests. The disadvantage for this approach is that you will be running your app remotely (unlike the desktop app when you are running your app on your local machine) and this means that the test code has to be running remotely as well. There is a corner case when you run your web app on your machine but this is not the idea of web applications.

    • Here is the simple tutorial for creating Java-based GUI
    • More complicated tutorial on creating a simple web form app for web

The idea is basically the same for all UI types. You provide the fields for the user, user fills them in, you get the values (almost like you did with Excel) and propagate them to your test code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.