I'm evaluating the use of automated selenium tests using BrowserStack. I'm currently trying to change the orientation of a device that runs on an emulator on BrowserStack, either Android or iPad. I've implemented the IRotatable interface as per the Selenium documentation:
public class RotatableRemoteWebDriver : RemoteWebDriver, IRotatable
{
public RotatableRemoteWebDriver(Uri uri, DesiredCapabilities dc, ScreenOrientation initialOrientation = ScreenOrientation.Portrait): base(uri, dc)
{
this.Orientation = initialOrientation;
}
public ScreenOrientation Orientation
{
get
{
var orientationResponse = this.Execute(DriverCommand.GetOrientation, null);
return (ScreenOrientation)Enum.Parse(typeof(ScreenOrientation), orientationResponse.Value.ToString(), true);
}
set
{
var response = this.Execute(DriverCommand.SetOrientation, new Dictionary<string, object>() { { "orientation", value.ToString().ToUpperInvariant() } });
}
}
}
When I try to use this with iPad capabilities I get directly an exception saying "Invalid method for resource: POST /session/1d410f56479543a99410140bc39dc3d0d6d94c57/orientation". The same call for Android capabilities does succeed but it doesn't seem to change the orientation since I take a screenshot directly afterwards and the device is still in portrait mode.
Any idea if it is at all possible to change orientation through the Automate testing or should I give up and use the Screenshots API for this?