Hello,
I’m using Appium in Ruby on Android real device Galaxy S4
I’m looking to get the screen and browser size but right now I’m using, after opening my webpage on Chrome:
@browser.execute_script(“return window.innerWidth”).to_i
@browser.execute_script(“return window.innerHeight”).to_i
@browser.execute_script(“return window.outerWidth”).to_i
@browser.execute_script(“return window.outerHeight”).to_i
@browser.execute_script(“return screen.width”).to_i
@browser.execute_script(“return screen.height”).to_i
But I have some very weird results (quite the same thing with Genymotion), because the S4 resolution is 1080 x 1920:
Windows innerwidth 980 - Windows outerwidth 360 - Screen width 360
Windows innerheight 1522 - Windows outerheight 559 - Screen height 640
So because it looks like java script is not recommanded with Watir, have you another way than js to get sizes ?
Thanks
my capabilities:
capabilities = {
caps: {
‘browserName’ => ‘Chrome’,
‘platformName’ => ‘Android’,
‘deviceName’ => ‘Android’
},
appium_lib: {
sauce_username: nil, # don’t run on Sauce
sauce_access_key: nil
}
}
@driver_appium = Appium::Driver.new(capabilities)
@driver = @driver_appium.start_driver
@browser = Watir::Browser.new @driver
@browser.driver.manage.timeouts.implicit_wait = 15