Appium-desktop: JSONWP cannot find "wda/screen" with Appium Desktop 1.3.2

Created on 12 Feb 2018  路  12Comments  路  Source: appium/appium-desktop

Appium Desktop 1.3.2

The problem

[XCUITest] Merging WDA caps over Appium caps for session detail response
[JSONWP Proxy] Proxying [GET /wda/screen] to [GET http://localhost:8100/session/17899A3B-E620-4116-87B3-7B9DB75008CD/wda/screen] with no body
[JSONWP Proxy] Got response with status 200: "{\n  \"value\" : \"Unhandled endpoint: \\/session\\/17899A3B-E620-4116-87B3-7B9DB75008CD\\/wda\\/screen -- http:\\/\\/localhost:8100\\/ with parameters {\\n    wildcards =     (\\n        \\\"session\\/17899A3B-E620-4116-87B3-7B9DB75008CD\\/wda\\/screen\\\"\\n    );\\n}\",\n  \"sessionId\" : \"17899A3B-E620-4116-87B3-7B9DB75008CD\",\n  \"status\" : 1\n}"
[MJSONWP] Encountered internal error running command: Error: An error occurred
    at JWProxy.command$ (/Applications/Appium-132.app/Contents/Resources/app/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:176:15)
    at tryCatch (/Applications/Appium-132.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium-132.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium-132.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium-132.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:136:37)

Environment

on Mac Sierra 10.12, testing on iPhone with iOS 10.3
On 1.3.1 its working fine. But when I update to 1.3.2, I got this error

Reproduce

  1. Run appium then run app
  2. Error will happen on start up.

Most helpful comment

Fixed:

Go to /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Commands/FBCustomCommands.m

in + (NSArray *)routes, Add in return array
[[FBRoute GET:@"/wda/screen"] respondWithTarget:self action:@selector(handleGetScreen:)]

Add bottom of this .m

+ (id<FBResponsePayload>)handleGetScreen:(FBRouteRequest *)request
{
  CGSize statusBarSize = [UIApplication sharedApplication].statusBarFrame.size;
  return FBResponseWithObject(
    @{
      @"statusBarSize": @{@"width": @(statusBarSize.width),
                          @"height": @(statusBarSize.height),
                          },
      @"scale": @([[UIScreen mainScreen] scale]),
      }
  );
}

All 12 comments

@mykola-mokhnach Do you know why this endpoint isn't supported?

Most likely the WDA agent on the device under test is cached. Manual uninstall should help

@mykola-mokhnach I've close everything and restart my computer and open Appium 1.3.2. The problem still there. Not sure what should i uninstall.
Thanks

@bonshington There's an app called WebDriverAgent that is installed to your Phone/Simulator... try uninstalling it manually and then running tests again.

No it was in appium-desktop source code

/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/lib/commands/general.js:

  200  commands.getViewportRect = iosCommands.device.getViewportRect;
  201  
  202: commands.getScreenInfo = async function () {
  203    return await this.proxyCommand('/wda/screen', 'GET');
  204  };
  205  
  206  commands.getStatusBarHeight = async function () {
  207:   const {statusBarSize} = await this.getScreenInfo();
  208    return statusBarSize.height;
  209  };
  ...
  211  // this function is memoized in the constructor
  212  commands.getDevicePixelRatio = async function () {
  213:   const {scale} = await this.getScreenInfo();
  214    return scale;
  215  };

Fixed:

Go to /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Commands/FBCustomCommands.m

in + (NSArray *)routes, Add in return array
[[FBRoute GET:@"/wda/screen"] respondWithTarget:self action:@selector(handleGetScreen:)]

Add bottom of this .m

+ (id<FBResponsePayload>)handleGetScreen:(FBRouteRequest *)request
{
  CGSize statusBarSize = [UIApplication sharedApplication].statusBarFrame.size;
  return FBResponseWithObject(
    @{
      @"statusBarSize": @{@"width": @(statusBarSize.width),
                          @"height": @(statusBarSize.height),
                          },
      @"scale": @([[UIScreen mainScreen] scale]),
      }
  );
}

@bonshington Yaahooooooo! Thanks fixed .

@bonshington your solution works well, thanks a lot!

@mykola-mokhnach I just noticed this now.... is @bonshington's fix something that should be merged to WDA or has this been resolved already?

@bonshington I have tried many methods, reinstall appium, reinstall webdriveragent, delete xcode cache, not work, your solution works well, Thanks!

@bonshington your solution work like charm ... Thank you ..

Fixed:

Go to /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Commands/FBCustomCommands.m

in + (NSArray *)routes, Add in return array
[[FBRoute GET:@"/wda/screen"] respondWithTarget:self action:@selector(handleGetScreen:)]

Add bottom of this .m

+ (id<FBResponsePayload>)handleGetScreen:(FBRouteRequest *)request
{
  CGSize statusBarSize = [UIApplication sharedApplication].statusBarFrame.size;
  return FBResponseWithObject(
    @{
      @"statusBarSize": @{@"width": @(statusBarSize.width),
                          @"height": @(statusBarSize.height),
                          },
      @"scale": @([[UIScreen mainScreen] scale]),
      }
  );
}

Can you explain why i was getting this error message

Was this page helpful?
0 / 5 - 0 ratings