headspinio / appium-roku-driver

A Roku Driver for Appium. https://headspin.io
Other
21 stars 2 forks source link

Getting SessionNotCreatedError when trying to run appium roku session #3

Open gshah30 opened 2 years ago

gshah30 commented 2 years ago

When I try to run a session with the headspin roku driver I get the SessionNotCreatedError error.

Caps used

caps = {
  'platformName' => 'Roku',
  'appium:automationName' => 'roku',
  'appium:app': "samples/media/VideoListExample/VideoListExample.zip",
  'appium:rokuHost' => '192.168.12.224',
  'appium:rokuEcpPort' => 8060,
  'appium:rokuWebPort' => 80,
  'appium:rokuUser' => 'rokudev',
  'appium:rokuPass' => 'abcd',
  'appium:rokuHeaderHost' => '192.168.12.224'
}

appium_driver = Appium::Driver.new({
  'caps' => caps,
  'appium_lib' => {
    :server_url => "http://0.0.0.0:4723"
  }}, true)
driver = appium_driver.start_driver

Appium logs

[gshah@workstation ~]$ appium
[Appium] Welcome to Appium v2.0.0-beta.33
[Appium] Attempting to load driver roku...
[debug] [Appium] Requiring driver at /home/gshah/.appium/node_modules/appium-roku-driver
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] Available drivers:
[Appium]   - roku@0.1.1 (automationName 'Roku')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[debug] [HTTP] Request idempotency key: c92870d8-f7de-419f-9546-ebb35edc38bc
[HTTP] --> POST /session
[HTTP] {"capabilities":{"alwaysMatch":{"platformName":"Roku","appium:automationName":"roku","appium:app":"samples/media/VideoListExample/VideoListExample.zip","appium:rokuHost":"192.168.12.224","appium:rokuEcpPort":8060,"appium:rokuWebPort":80,"appium:rokuUser":"rokudev","appium:rokuPass":"abcd","appium:rokuHeaderHost":"192.168.12.224"},"firstMatch":[{}]}}
[debug] [AppiumDriver@cc72] Calling AppiumDriver.createSession() with args: [null,null,{"alwaysMatch":{"platformName":"Roku","appium:automationName":"roku","appium:app":"samples/media/VideoListExample/VideoListExample.zip","appium:rokuHost":"192.168.12.224","appium:rokuEcpPort":8060,"appium:rokuWebPort":80,"appium:rokuUser":"rokudev","appium:rokuPass":"abcd","appium:rokuHeaderHost":"192.168.12.224"},"firstMatch":[{}]}]
[debug] [AppiumDriver@cc72] Event 'newSessionRequested' logged at 1654250091931 (15:24:51 GMT+0530 (India Standard Time))
[Appium] Attempting to find matching driver for automationName 'roku' and platformName 'Roku'
[Appium] The 'roku' driver was installed and matched caps.
[Appium] Will require it at /home/gshah/.appium/node_modules/appium-roku-driver
[debug] [Appium] Requiring driver at /home/gshah/.appium/node_modules/appium-roku-driver
[AppiumDriver@cc72] Appium v2.0.0-beta.33 creating new RokuDriver (v0.1.1) session
[AppiumDriver@cc72] Checking BaseDriver versions for Appium and RokuDriver
[AppiumDriver@cc72] Appium's BaseDriver version is 8.5.2
[AppiumDriver@cc72] Could not determine RokuDriver's BaseDriver version
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: undefined
GSHAH777: {} {"platformName":{"isString":true,"inclusionCaseInsensitive":["Roku"],"presence":{"allowEmpty":false}},"deviceName":{"isString":true},"platformVersion":{"isString":true},"newCommandTimeout":{"isNumber":true},"automationName":{"isString":true},"autoLaunch":{"isBoolean":true},"udid":{"isString":true},"orientation":{"inclusion":["LANDSCAPE","PORTRAIT"]},"autoWebview":{"isBoolean":true},"noReset":{"isBoolean":true},"fullReset":{"isBoolean":true},"language":{"isString":true},"locale":{"isString":true},"eventTimings":{"isBoolean":true},"printPageSourceOnFindFailure":{"isBoolean":true},"app":{"isString":true,"presence":{"allowEmpty":false}},"appId":{"isString":true,"presence":{"allowEmpty":false}},"contentId":{"isString":true},"mediaType":{"isString":true},"ip":{"isString":true,"presence":{"allowEmpty":false}},"password":{"isString":true,"presence":{"allowEmpty":false}},"username":{"isString":true,"presence":false}}
[BaseDriver] SessionNotCreatedError: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): console.log(...) is not a function
[BaseDriver]     at RokuDriver.validateDesiredCaps (/home/gshah/.appium/node_modules/appium-roku-driver/node_modules/appium-base-driver/lib/basedriver/driver.js:233:6)
[BaseDriver]     at RokuDriver.validateDesiredCaps (/home/gshah/.appium/node_modules/appium-roku-driver/build/lib/..\../lib/driver.js:130:21)
[BaseDriver]     at RokuDriver.createSession (/home/gshah/.appium/node_modules/appium-roku-driver/node_modules/appium-base-driver/lib/basedriver/commands/session.js:46:8)
[BaseDriver]     at RokuDriver.createSession (/home/gshah/.appium/node_modules/appium-roku-driver/build/lib/..\../lib/driver.js:32:33)
[BaseDriver]     at AppiumDriver.createSession (/usr/lib/node_modules/appium/lib/appium.js:298:56)
[BaseDriver]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[RokuDriver] Shutting down Roku driver
[RokuDriver] Check installed app...
[debug] [AppiumDriver@cc72] Event 'newSessionStarted' logged at 1654250092032 (15:24:52 GMT+0530 (India Standard Time))
[debug] [AppiumDriver@cc72] Encountered internal error running command: SessionNotCreatedError: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): console.log(...) is not a function
[debug] [AppiumDriver@cc72]     at RokuDriver.validateDesiredCaps (/home/gshah/.appium/node_modules/appium-roku-driver/node_modules/appium-base-driver/lib/basedriver/driver.js:233:6)
[debug] [AppiumDriver@cc72]     at RokuDriver.validateDesiredCaps (/home/gshah/.appium/node_modules/appium-roku-driver/build/lib/..\../lib/driver.js:130:21)
[debug] [AppiumDriver@cc72]     at RokuDriver.createSession (/home/gshah/.appium/node_modules/appium-roku-driver/node_modules/appium-base-driver/lib/basedriver/commands/session.js:46:8)
[debug] [AppiumDriver@cc72]     at RokuDriver.createSession (/home/gshah/.appium/node_modules/appium-roku-driver/build/lib/..\../lib/driver.js:32:33)
[debug] [AppiumDriver@cc72]     at AppiumDriver.createSession (/usr/lib/node_modules/appium/lib/appium.js:298:56)
[debug] [AppiumDriver@cc72]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[HTTP] <-- POST /session 500 119 ms - 1132

I tried to debug the issue by adding

console.log(`GSHAH777: ${JSON.stringify(caps)} ${JSON.stringify(this._constraints)}`)

inside appium base driver and I can see that the function validateDesiredCaps throws error because it gets the caps object as {} and it tries to validate it with the constraints
{"platformName":{"isString":true,"inclusionCaseInsensitive":["Roku"],"presence":{"allowEmpty":false}},"deviceName":{"isString":true},"platformVersion":{"isString":true},"newCommandTimeout":{"isNumber":true},"automationName":{"isString":true},"autoLaunch":{"isBoolean":true},"udid":{"isString":true},"orientation":{"inclusion":["LANDSCAPE","PORTRAIT"]},"autoWebview":{"isBoolean":true},"noReset":{"isBoolean":true},"fullReset":{"isBoolean":true},"language":{"isString":true},"locale":{"isString":true},"eventTimings":{"isBoolean":true},"printPageSourceOnFindFailure":{"isBoolean":true},"app":{"isString":true,"presence":{"allowEmpty":false}},"appId":{"isString":true,"presence":{"allowEmpty":false}},"contentId":{"isString":true},"mediaType":{"isString":true},"ip":{"isString":true,"presence":{"allowEmpty":false}},"password":{"isString":true,"presence":{"allowEmpty":false}},"username":{"isString":true,"presence":false}}

Is the Headspin's Roku Driver suitable for production use ?

jlipps commented 2 years ago

@gshah30 it looks like a different project was published on npm under the name of this project.

i've recently updated the driver to work with the latest appium 2 beta. please ensure you have that then re-check the README for the new name of this driver on NPM, and try that way (make sure to uninstall any existing roku driver from appium)

srinuchinta commented 11 months ago

@gshah30 could you please share the Roku tv capabilities (appium 2.0 with Java 11) caps.setCapability("appium:rokuUser", "rokudev"); caps.setCapability("appium:rokuPass", 1111); caps.setCapability("appium: rokuHost", "192.168.99.74"); caps.setCapability("appium:rokuEcpPort", 8060); caps.setCapability("platformName", "Roku"); caps.setCapability("appium:automationName", "Roku"); caps.setCapability("appium:rokuHeaderHost", "192.168.99.74"); caps.setCapability("appium:rokuWebPort", 80); caps.setCapability("appium:platformVersion", "11"); caps.setCapability("app", "dev"); driver = WebDriver(new URL("http://0.0.0.0:"+"4723"+"/wd/hub"), caps);