Here's the code I used to integrate my local Selenium tests with BrowserStack's Automate. Their documentation and customer support helped me achieve it.