Uploading image(profile pic)

Hi

I am not able to click on the gallery icon which occurs when I click on Upload Profile in my app using appium. I had tried even absolute xpath where it says ‘element not found’. Please let me know how to do this and further steps to upload image.

Thanks
Nic

use the class name and resource id combination to write the xpath.
For ex,xpath=classname[@id=‘id value’]

Hi vani,

I had tried as you had said but no luck. Check below image for any help

driver.findElement(By.xpath("//android.widget.RelativeLayout[contains(@resource-id,‘rl_gallery’)]")).click();

Thanks,
Nic

NAF=true,

From my experiences, I gave up with that kind of element.

I just applied a workaround by touching on element’s location. The problem comes if you test with another devices with different screen size.

Looking for a better solution…

Hi TuHuynh,

Do you say that even absolute xpath given below too doesn’t work. I had tried this way too but no luck.

driver.findElement(By.xpath("//android.widget.FrameLayout[@index=‘0’]/android.widget.LinearLayout[@index=‘0’]/android.widget.FrameLayout[@index=‘0’]/android.widget.LinearLayout[@index=‘0’]/android.widget.FrameLayout[@index=‘0’]/android.view.View/android.widget.LinearLayout[@index=‘1’]/android.support.v4.view.ViewPager[@index=‘2’]/android.view.View/android.widget.LinearLayout[@index=‘1’]/android.widget.RelativeLayout[@index=‘1’]")).click();

Thanks,
Nic

No, I meant bounds [540, 1770]
I would use Touch action to touch on [550, 1780]

1 Like

Hey, thx bro :+1:
The above one worked for me

1 Like

Happy when hearing that but pay attention when changing the testing device. It doesn’t happen quietly but will.

Happy testing!

@nicole_jessica

I think you should refer this for more options because there was an element with NAF=true but we don’t need to use Touch action.

1 Like

Hey,

Thanks for getting back with more information. But unfortunately I had got stuck with one more issue where I cannot click on the folders in the gallery as shown in the image below.

I want to click on the 3rd folder where I want to select the pic out of the available pics(12). I had used x,y co-ordinates as shown below.

TouchAction Action2 = new TouchAction(driver).tap(530,1565);
Action2.perform();

Please suggest.

Thanks,
Nic