简体   繁体   中英

How to change android chrome browser orientation using appium with Java

Im getting below exception while using below code

DesiredCapabilities  capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","Android");
capabilities.setCapability("browserName", "Chrome");      
capabilities.setCapability(CapabilityType.VERSION, "5.1.1");
capabilities.setCapability("platformName", "Android"); 

capabilities.setCapability(CapabilityType.ROTATABLE, true);    

capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");

driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.get("http://gmail.com");    
((Rotatable) driver).rotate(ScreenOrientation.LANDSCAPE);

FAILED CONFIGURATION: @BeforeTest beforeTest org.openqa.selenium.WebDriverException:

unimplemented command: session/499d07270cddecd7890c7a909641ecf1/orientation
Command duration or timeout: 47 milliseconds
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58'
System info: host: 'BALAP-HYD', ip: '10.144.22.34', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=44.0.2403.133, platform=ANDROID, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]

Session ID: 499d07270cddecd7890c7a909641ecf1

轮换之前请尝试以下操作:

driver.context("NATIVE_APP");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM