I know Roku Webdriver repository comes with python and Postman sample scripts but I was wondering if I could use my Java scripts - not javascript - to connect to go and automate. If so, does anyone have any examples how to setup the driver in Java?
Will Roku WebDriver setup work with my Java framework
522 Views Asked by jimbaker AtThere are 3 best solutions below

You can give a try Rokuality.
From README: it is one of the first projects to provide support for the Roku WebDriver API.
If it is not up-to-date, you can take a core as a basis for your test framework

My recommendation would be to download the solution that Roku provides, read the API documentation, use their sample solution for Python, JavaScript and/or Postman to get familiar with the technology, then write your own solution for Java.
The core of the Roku WebDriver solution is an HTTP server which sends ECP commands (remote control primarily) and is able to query the XML source of the Roku channel under test to responses in JSON wire protocol format. Using the documentation and the sample libraries, it will be a straight forward task to write a class for your Java solution which can send GET and POST requests to the WebDriver HTTP server. You can use the Roku provided Go language solution to compile binaries for the HTTP server on the platform(s) you want to support (Mac/Linux/Windows, etc.) and then include the binaries in your solution. You will also want to write a class to to launch and manage the state of the HTTP server and likely extend the solution further to do other things like parsing the responses of the JSON responses from the server, capturing logs from devices and saving screenshots.
Though I have not used Java with Roku WebDriver, I started working with Roku WebDriver shortly after it was released. We wanted to use JavaScript and at the time, Roku had not yet released their JavaScript library, so I wrote one for the project I am working on. It was a pretty straight forward task with Roku's API documentation and Robot Framework library to reference. I see no reason you couldn't do the same in Java, C# or comparable languages.
Note: another user pointed out the Rokuality solution. While it certainly wouldn't hurt to review their implementation to learn from it, it would seem to have a lot of complexity which you don't likely need. A lot of the solution seems designed to interact with the Rokuality cloud service offering and at this point their domain doesn't go anywhere, so I'm not sure they are still up and running.
I figured it out. If anyone is interested in automating it in Java, this code will work as a starting point. Make sure to connect to Go server first. The steps are on https://developer.roku.com/en-ca/docs/developer-program/dev-tools/automated-channel-testing/automated-testing-overview.md . Dont forget to update bash or zshrc with
Once the server is running, run the code. Make sure you add your own IP. Thats located in settings on the Roku device. Also add a close method so that you wont get any errors that the "session is already running". If you do get that, just reset the server.
Again this is just a starting point - use the APIs in https://developer.roku.com/en-ca/docs/developer-program/dev-tools/automated-channel-testing/web-driver.md to really start automating.
POM: