File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ export class AppiumDriver {
272272 logInfo ( "Current version of appium doesn't support appium settings!" ) ;
273273 }
274274
275- await DeviceManager . applyDeviceAdditionsSettings ( driver , args , appiumCapsFromConfig ) ;
275+ await DeviceManager . applyDeviceAdditionsSettings ( driver , args , sessionInfoDetails ) ;
276276
277277 hasStarted = true ;
278278 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ export class DeviceManager implements IDeviceManager {
202202 args . device . config = { "density" : args . device . deviceScreenDensity || args . device . config . density , "offsetPixels" : + sessionInfoDetails . statBarHeight || args . device . config . offsetPixels } ;
203203 } else {
204204 args . device . apiLevel = sessionInfoDetails . platformVersion ;
205- args . device . deviceScreenDensity = sessionInfoDetails . pixelRatio ;
205+ args . device . deviceScreenDensity = sessionInfoDetails . pixelRatio || args . device . config . density ;
206206 const offsetPixels = + sessionInfoDetails . viewportRect . top - + sessionInfoDetails . statBarHeight ;
207207 args . device . config = { "density" : sessionInfoDetails . pixelRatio || args . device . config . density , "offsetPixels" : isNumber ( offsetPixels ) ? offsetPixels : args . device . config . offsetPixels } ;
208208 }
@@ -272,11 +272,11 @@ export class DeviceManager implements IDeviceManager {
272272 // }
273273
274274 public static async applyDeviceAdditionsSettings ( driver , args : INsCapabilities , sessionInfo : any ) {
275- if ( ( ! args . device . viewportRect || ! args . device . viewportRect . x ) && ( ! args . device . config || ! args . device . config . offsetPixels ) ) {
275+ if ( ( ! args . device . viewportRect || ! args . device . viewportRect . x ) && ( ! args . device . config || ! isNumber ( args . device . config . offsetPixels ) ) ) {
276276 args . device . config = { } ;
277277 let density : number ;
278- if ( sessionInfo && sessionInfo . length >= 1 ) {
279- density = sessionInfo [ 1 ] . deviceScreenDensity ? sessionInfo [ 1 ] . deviceScreenDensity / 100 : undefined ;
278+ if ( sessionInfo && Object . getOwnPropertyNames ( sessionInfo ) . length >= 1 ) {
279+ density = sessionInfo . pixelRatio ? sessionInfo . pixelRatio : undefined ;
280280 }
281281
282282 if ( density ) {
Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ export class UIElement {
242242 */
243243 public async getActualRectangle ( ) {
244244 const actRect = await this . getRectangle ( ) ;
245- const density = this . _args . device . config . density ;
245+ const density = this . _args . device . deviceScreenDensity ;
246246 if ( this . _args . isIOS ) {
247247 if ( density ) {
248248 actRect . x *= density ;
You can’t perform that action at this time.
0 commit comments