How to run java SeInterpreter script on browserstack? (Works fine on nodeJS version - see info)

101 views
Skip to first unread message

David Vardy

unread,
Oct 28, 2016, 11:28:59 AM10/28/16
to Se Builder
I've seen what looks like only partial documentation on this subject. From this, and a few other random posts online, I've gleaned:

java -jar SeInterpreter.jar yourscript.json --driver=Remote --driver.browserName=firefox --driver.platformName=windows --driver.url=http://username:k...@hub.browserstack.com/

However, this returns:

java.lang.RuntimeException: Test run failed: unable to create driver.
        at com.sebuilder.interpreter.TestRun.initRemoteWebDriver(TestRun.java:274)
        at com.sebuilder.interpreter.TestRun.next(TestRun.java:147)
        at com.sebuilder.interpreter.TestRun.finish(TestRun.java:196)
        at com.sebuilder.interpreter.SeInterpreter.main(SeInterpreter.java:101)
Caused by: org.openqa.selenium.WebDriverException: Session not started or terminated (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 340 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'

Or should a config.json file be setup that contains the information, in which case how is this taken into account? Something like:

java -jar SeInterpreter.jar test.json   (and it automatically looks up the config file? If so, what do you name the config file?)



For anyone looking to run the nodeJS SeInterpreter with browserstack, I do have this working:

Ref: https://www.npmjs.com/package/se-interpreter

  1. Installed node.js installer containing npm manager:   https://nodejs.org/en/download/

  2. Downloaded repo: https://github.com/Zarkonnen/se-interpreter

  3. Inside repo, Cmd:   npm install

  4. Run selenium server (if running test on local browser, otherwise not required for browserstack)

  5. Open CMD - cd to interpreter.js dir -  "C:\Program Files\nodejs\node" interpreter.js config.json

  6. Json files:     config.json (lists suite.json)      suite.json (lists option to share state and individual script files)


config file example:
{
  "type": "interpreter-config",
  "configurations": [
    {
      "settings": [
        {
          "driverOptions": {
            "host": "hub.browserstack.com",
            "port": 80
          },
          "browserOptions": {
            "browserName": "firefox",
            "browserstack.user": "youremail",
            "browserstack.key": "yourkey"
          }
        }
      ],
      "scripts": [
        "suite.json"
      ]
    }
  ]
}




suite.json:
{
  "type": "suite",
  "seleniumVersion": "2",
  "formatVersion": 1,
  "scripts": [
    {
      "where": "local",
      "path": "bbctest.json"
    },
    {
      "where": "local",
      "path": "googletest.json"
    }
  ],
  "shareState": true
}



bbctest.json:
{
  "type": "script",
  "seleniumVersion": "2",
  "formatVersion": 2,
  "steps": [
    {
      "type": "get",
      "url": "https://www.bbc.co.uk"
    },
    {
      "type": "store",
      "text": "News",
      "variable": "myvar"
    },
{
      "type": "assertTextPresent",
      "text": "${myvar}"
    }
  ],
  "data": {
    "configs": {},
    "source": "none"
  },
  "inputs": [],
  "timeoutSeconds": 60
}



If anyone knows how to get SeInterpreter working (java version) with browserstack, please let me know. For the rest of you, hope the above helps if you're looking to get nodeJS working with it.
Reply all
Reply to author
Forward
0 new messages