NoSuchElementError from appium response when the element is visible and exist


#1

[[35m[HTTP]^[[39m ^[[37m–>^[[39m ^[[37mPOST^[[39m ^[[37m/wd/hub/session/e924be69-537f-41cb-b294-47e4571ae5c8/element^[[39m
^[[35m[HTTP]^[[39m ^[[90m{“using”:“accessibility id”,“value”:“menu”}^[[39m
[debug] ^[[35m[MJSONWP]^[[39m Calling AppiumDriver.findElement() with args: [“accessibility id”,“menu”,“e924be69-537f-41cb-b294-47e4571ae5c8”]
[debug] ^[[35m[XCUITest]^[[39m Executing command ‘findElement’
[debug] ^[[35m[BaseDriver]^[[39m Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] ^[[35m[BaseDriver]^[[39m Waiting up to 0 ms for condition
[debug] ^[[35m[JSONWP Proxy]^[[39m Matched ‘/element’ to command name ‘findElement’
[debug] ^[[35m[JSONWP Proxy]^[[39m Proxying [POST /element] to [POST http://localhost:8100/session/F7923CDE-61E0-45D5-8691-6591A80D301C/element] with body: {“using”:“accessibility id”,“value”:“menu”}
[debug] ^[[35m[JSONWP Proxy]^[[39m Got response with status 200: {“value”:{“using”:“accessibility id”,“value”:“menu”,“description”:“unable to find an element”},“sessionId”:“F7923CDE-61E0-45D5-8691-6591A80D301C”,“status”:7}
[debug] ^[[35m[MJSONWP]^[[39m Matched JSONWP error code 7 to NoSuchElementError
[debug] ^[[35m[MJSONWP]^[[39m Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.


#2

Can you please paste the code that is trying to do this?


#3

$(~menu).waitForVisible() &&
$(~menu).click();

Above are the code to access the element
But the appium is unable to locate the element though it’s visible on the mobile screen page


#4

In Java you have to tell it what element you’re clicking . This can either be done via xpath or element ID. I think you also need to do the same.


#5

Hi Tom, Yes I did
but somehow, I got this in the appium.log:5671909/element] with body: {“using”:“accessibility id”,“value”:“menu”}
[debug] ^[[35m[JSONWP Proxy]^[[39m Got response with status 200: {“value”:{“using”:“accessibility id”,“value”:“menu”,“description”:“unable to find an element”},“sessionId”:“F3C53D73-43A4-4F8D-9C1D-E85EA5671909”,“status”:7}
[debug] ^[[35m[MJSONWP]^[[39m Matched JSONWP error code 7 to NoSuchElementError
[debug] ^[[35m[JSONWP Proxy]^[[39m Matched ‘/source’ to command name ‘getPageSource’
[debug] ^[[35m[JSONWP Proxy]^[[39m Proxying [GET /source] to [GET http://localhost:8100/session/F3C53D73-43A4-4F8D-9C1D-E85EA5671909/source] with no body


#6

got it resolved, http://appium.io/docs/en/commands/mobile-command/


#8

Hi Tirzah,

Can you please let us know how exactly you got the solution for this issue.

Thanks in advance