# iOS ImageElement - Manually set image or device resolution (using Appium 1.9.1, python client)

**URL:** <https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406>\
**Category:** Support\
**Created:** [November 28, 2018, 1:10am UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406 "2018-11-28T01:10:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![qa\_adrian](https://discuss.appium.io/user_avatar/discuss.appium.io/qa_adrian/32/6682_2.png) [@qa\_adrian](https://discuss.appium.io/u/qa_adrian)\
**Post date:** [November 28, 2018, 1:10am UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406/1 "2018-11-28T01:10:07Z")

</div>

Appium v1.9.1  
python-client 0.28

Hello, was wondering if there is a way to change the window size for iOS to use the true resolution of the device rather than a scaled version? OR have find\_element\_by\_image() use a scaled version screenshot as a reference image.

Cheers,

#### BACKGROUND

I’m using the **-image** locator option but I can’t seem to get iOS to tap on the image after locating it (no issues with Android using the default settings)

Seems due to pixel scaling on iOS, the location tapped is off.

#### DEVICE INFO

iPhone 7 - 11.4 --\> 750x1334 (True resolution)  
driver.get\_window\_size() --\> 375 \* 667 (scaled resolution)

#### DETAILS

1. Using **find\_element\_by\_image()** returns an ImageElement based off of the true resolution of the device. This includes the _center\_x_ and _center\_y_ values. For example, lets say the values are x=100, y=200

2. Creating a reference image using **save\_screenshot()**, I confirmed the coords from ImageElement are correct. Ie. x=100 and y=200 is the center of the image element.

NOTE: **save\_screenshot()** creates a PNG image with the true resolution

1. When **ImageElement.click()** is called, I noticed a different element is tapped.  
Doing some debugging, I realized it was tapping on x=100, y=200 on the scaled resolution(375 \* 667)

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [November 28, 2018, 10:12am UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406/2 "2018-11-28T10:12:26Z")

</div>

Check if any of image lookup settings are helpful there: [https://github.com/appium/appium-base-driver/blob/f510db0257110a755c9f2976bf7580abc9402bc9/lib/basedriver/device-settings.js](https://github.com/appium/appium-base-driver/blob/f510db0257110a755c9f2976bf7580abc9402bc9/lib/basedriver/device-settings.js)

---

<div class="post-metadata">

**Author:** ![qa\_adrian](https://discuss.appium.io/user_avatar/discuss.appium.io/qa_adrian/32/6682_2.png) [@qa\_adrian](https://discuss.appium.io/u/qa_adrian)\
**Post date:** [November 29, 2018, 5:28pm UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406/3 "2018-11-29T17:28:07Z")

</div>

thanks for the reply mykola-mokhnach!

I looked into the settings but unfortunately, same results. My settings are:

> {  
> ‘imageMatchThreshold’: 0.4,  
> ‘fixImageFindScreenshotDims’: True,  
> ‘fixImageTemplateSize’: False,  
> ‘checkForImageElementStaleness’: True,  
> ‘autoUpdateImageElementPosition’: False,  
> ‘imageElementTapStrategy’: ‘w3cActions’,  
> }

Toggling the settings for **fixImageFindScreenshotDims** and **fixImageTemplateSize** doesn’t seem to produce different results. The ImageElement is always created with:  
x 67  
y 248  
width 666  
height 152  
center\_x 400  
center\_y 310  
The coords above suggest they’re taken from the True Resolution as get\_window\_size() returns {‘width’: 375, ‘height’: 667}

Setting **checkForImageElementStaleness** and **autoUpdateImageElementPosition** to True seems to yield the same results.

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [November 30, 2018, 2:20pm UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406/4 "2018-11-30T14:20:01Z")

</div>

@jlipps Can you please take a look?

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [November 30, 2018, 9:30pm UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406/5 "2018-11-30T21:30:23Z")

</div>

@qa_adrian as workaround you can get center of image element and click yourself 😉 by x and y with scaling whatever needed.

---

<div class="post-metadata">

**Author:** ![qa\_adrian](https://discuss.appium.io/user_avatar/discuss.appium.io/qa_adrian/32/6682_2.png) [@qa\_adrian](https://discuss.appium.io/u/qa_adrian)\
**Post date:** [November 30, 2018, 10:23pm UTC](https://discuss.appium.io/t/ios-imageelement-manually-set-image-or-device-resolution-using-appium-1-9-1-python-client/24406/6 "2018-11-30T22:23:08Z")

</div>

@Aleksei sounds good to me. cheers.

Thanks for looking into it everyone 🙂
