Make sure you install python and selenium in your system.
Just add your Browserstack credentials in the capability section and run the code
This is a python code written by GrandEL to run a selenium 4 test on Browserstack with Javascript executors to set the session status to passed or fail.
Python