Accessing a photo from the Android Gallery, Javascript, help!

I am trying to write an automation that will create a post, and use a photo from the built in gallery (Android) as the body of the post. When I use the inspector and build the automation using record, tapping on the specific coordinates of the gallery list, and the unique photo works, and the process moves on. However, when I run the automation as part of my testing suite, when I get to the point of tapping the gallery to use, and the unique photo to use, nothing happens. Any help would be greatly appreciated. Here is the code I am using for this automation. (the XPaths have been saves as variables at the top of the file by the way)

return driver
.elementByXPath(addPostButton).click()
.elementByXPath(postWithCameraButton).click()
.elementByXPath(galleryButton).click()
.elementByXPath(justOnceButton).click()
.elementByXPath(cameraGallery).click()
.sleep(5000)
.execute(“mobile: tap”, { “tapCount”: 1, “touchCount”: 2, “duration”: 1.2447265625, “x”: 273, “y”: 447 })
.sleep(5000)
.execute(“mobile: tap”, { “tapCount”: 1, “touchCount”: 2, “duration”: 1.17763671875, “x”: 219, “y”: 397 })
.sleep(5000)
.elementByXPath(submitPostButton).click()
.sleep(5000)
.fin(function() {
done();
});

Did ur test case pass or fail… If it fails that means something that was present at time of recording is not present at time of suite run…
Only debug can help here…
What appium logs says about command which do nothing…

The test passes, but the tap on the coordinates passed in don’t seem to find the gallery image to use. I’ve already added a sleep() method to pause the automation and ensure that everything loads. Any other advice? Here is the log I got on my most recent run through

info: --> POST /wd/hub/session/04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84/execute {“script”:“mobile: tap”,“args”:{“tapCount”:1,“touchCount”:2,“duration”:1.2447265625,“x”:273,“y”:447}}

info: [debug] Pushing command to appium work queue: [“click”,{“x”:0.5,“y”:0.5}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“click”,“params”:{“x”:0.5,“y”:0.5}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][1080,1776]

info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}

info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84”}
info: <-- POST /wd/hub/session/04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84/execute 200 118.639 ms - 76 {“status”:0,“value”:true,“sessionId”:“04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84”}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.8”,“revision”:“c8179bd8352d3c62d98fa58b324491230df9342a”}},“sessionId”:“04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84”}
info: <-- GET /wd/hub/status 200 0.556 ms - 155 {“status”:0,“value”:{“build”:{“version”:“1.4.8”,“revision”:“c8179bd8352d3c62d98fa58b324491230df9342a”}},“sessionId”:“04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84”}

info: --> POST /wd/hub/session/04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84/execute {“script”:“mobile: tap”,“args”:{“tapCount”:1,“touchCount”:2,“duration”:1.17763671875,“x”:219,“y”:397}}

info: [debug] Pushing command to appium work queue: [“click”,{“x”:0.5,“y”:0.5}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“click”,“params”:{“x”:0.5,“y”:0.5}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][1080,1776]

info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84”}
info: <-- POST /wd/hub/session/04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84/execute 200 109.558 ms - 76 {“status”:0,“value”:true,“sessionId”:“04843b1b-6ae6-44c6-ba6c-c09ca2fa4c84”}

Is it possible to get tapping coordinates with some reliable way instead of hardcoding …

int xcord = driver.findElement(By.name(“content-desc of element”)).getLocation.getX();
int ycord = driver.findElement(By.name(“content-desc of element”)).getLocation.getY();

When I view the element (the gallery or the photo) I can’t even see an element to name. The inspector just doesn’t see it. :frowning: