'How To Execute Selenium Scripts In A Angular/SpringBoot App?

I have an app with angular on the front and spring boot on the back. I also have selenium scripts in a python file that I run with pytest directly in the python main() function.

What I want is to be able to invoke those scripts after clicking on a button in the angular app.

What I tried:

  1. Using child_process and python_interpreter in Angular But I Had Errors I Was Told That The Front End Cannot Launch Processes And That It Was A Bad Idea.

It Was Preferrable To Do It Via The Backend And Then Set The Button Click Event To An Http.Get That Will Launch The Body Of My Function In The Spring Controller

  1. So Actually I Had To Launch A Python File In A Java Class So I Tried "Runtime.exec()" and "Process.start()" (I Don't Remember The Exact Names) But Still Without Success

  2. Now I'm Thinking Of Writing The Selenium Scripts Directly In Java But And Launching Them With TestNG or Something Equivalent To Pytest But I'm Not Sure...

If anyone could give me advice or clarify about the right way to go about it.

NB : I would also like to have the test statistics after that (failed, passed, errors, etc...).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source