Rotate device on an emulator in Javascript

I’m writing node test app, using promise q chain and I need to rotate the emulator. Anyone knows the syntax? it should something like driver.rotate({‘somethingKey’: ‘landscape/portrait’})

Does driver.rotate didnt helped your purpose?

You can use below methods(java bindings)

driver.getOrientation().value(); //To find the current orientation

//To set the orientation to Landscape
driver.rotate(ScreenOrientation.LANDSCAPE);

//To set orientation to Portrait
driver.rotate(ScreenOrientation.PORTRAIT);

Hi UD,

I tried your code. the driver.getOrientation().value() gets the result of {status: ‘pending’}.

and I used driver.rotate(1) to replace driver.rotate(ScreenOrientation.LANDSCAPE) as ScreenOrientation is undefined (maybe I missed any plugin?). It does not rotate the device.

I also found that in the API, the rotate function is defined as

rotate(element, opts, cb) -> cb(err)
rotate(opts, cb) -> cb(err)
opts is like the following:
{x: 114, y: 198, duration: 5, radius: 3, rotation: 220, touchCount: 2}
element.rotate(opts, cb) -> cb(err)
opts is like the following:
{x: 114, y: 198, duration: 5, radius: 3, rotation: 220, touchCount: 2}

So I am confused.

I am working on:

exports.ios83 = {
  browserName: 'safari',
  'appium-version': '1.4.0',
  platformName: 'iOS',
  platformVersion: '8.3',
  deviceName: 'iPhone 4s',
  app: undefined // will be set later
};

I found the way of using

driver.setOrientation('LANDSCAPE')

to do the work.

Which binding are you using to have “setOrientation” method. I am using Java bindings, which doesnt have this method.

I am using java client 2.1.0.

I am with wd. the js implementation, the same as Ori_Harel.