Execute individual Selenium test via command line in Play Framework without GUI

How can I run a specific Selenium test from terminal in Play Framework?

I’m working with Play Framework and I know I can execute individual Selenium tests through the web interface. The problem is I want to run just one specific test from the command line instead of using the browser UI.

When I use play test-only command, it runs my entire test suite including both unit tests and Selenium tests. I need a way to target and execute only one particular Selenium test case using the headless browser mode.

Is there a specific command or parameter I can use to achieve this? I want to verify if a single test passes without opening the browser interface and without running the complete test suite.

For example, if I have a test called LoginPageTest, how can I run only that one test from the terminal? Any suggestions would be helpful.

yeah, try the -Dtest.single param with your test name. run play test -Dtest.single=LoginPageTest n it should work. just make sure selenium’s set to headless mode or u’ll get browser windows popping up.

Another approach that works well is using testOnly directly in the Play console. Just start with play then run testOnly tests.selenium.LoginPageTest (or whatever your package structure is). You get better control over test execution and cleaner output. Make sure you’ve got headless browser settings in your application.conf file - otherwise browser windows will still pop up. I’ve found this way more reliable than command line parameters, especially with complex test hierarchies.

To run a specific Selenium test from the terminal in Play Framework, use test-only with your test’s full class path. For example: play test-only tests.LoginPageTest (adjust for your package structure). Watch out for case sensitivity in class and package names. If you’re not sure about the full path, try wildcards like test-only *LoginPageTest. This runs just that test without the whole suite and keeps headless execution.