File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ export class AppiumDriver {
272
272
logInfo ( "Current version of appium doesn't support appium settings!" ) ;
273
273
}
274
274
275
- await DeviceManager . applyDeviceAdditionsSettings ( driver , args , appiumCapsFromConfig ) ;
275
+ await DeviceManager . applyDeviceAdditionsSettings ( driver , args , sessionInfoDetails ) ;
276
276
277
277
hasStarted = true ;
278
278
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ export class DeviceManager implements IDeviceManager {
202
202
args . device . config = { "density" : args . device . deviceScreenDensity || args . device . config . density , "offsetPixels" : + sessionInfoDetails . statBarHeight || args . device . config . offsetPixels } ;
203
203
} else {
204
204
args . device . apiLevel = sessionInfoDetails . platformVersion ;
205
- args . device . deviceScreenDensity = sessionInfoDetails . pixelRatio ;
205
+ args . device . deviceScreenDensity = sessionInfoDetails . pixelRatio || args . device . config . density ;
206
206
const offsetPixels = + sessionInfoDetails . viewportRect . top - + sessionInfoDetails . statBarHeight ;
207
207
args . device . config = { "density" : sessionInfoDetails . pixelRatio || args . device . config . density , "offsetPixels" : isNumber ( offsetPixels ) ? offsetPixels : args . device . config . offsetPixels } ;
208
208
}
@@ -272,11 +272,11 @@ export class DeviceManager implements IDeviceManager {
272
272
// }
273
273
274
274
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 ) ) ) {
276
276
args . device . config = { } ;
277
277
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 ;
280
280
}
281
281
282
282
if ( density ) {
Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ export class UIElement {
242
242
*/
243
243
public async getActualRectangle ( ) {
244
244
const actRect = await this . getRectangle ( ) ;
245
- const density = this . _args . device . config . density ;
245
+ const density = this . _args . device . deviceScreenDensity ;
246
246
if ( this . _args . isIOS ) {
247
247
if ( density ) {
248
248
actRect . x *= density ;
You can’t perform that action at this time.
0 commit comments