An element could not be located on the page using the given search parameters

I’m facing an issue where appium is unable to find elements on the device even if i do see the element on screen

appium - 1.3.3 (installed from npm)
android - 4.4.2
mac os x 10.10

Running with Appium-Python-Client==0.11

Desired capabilities:

desired_caps = {
    'platformName': 'Android',
    'deviceName': 'Magneto UI Tester',
    'androidPackage': '<app package>',
    'appActivity': '<app activity>',
    'app': '<path to apk>'
}

Appium log output:

info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"me.everything.launcher:id/done_btn","context":"","mul
tiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"me.everything.launcher:id/done_btn","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding me.everything.launcher:id/done_btn using ID with the contextId:  multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=me.everything.launcher:id/done_btn]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 792ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"ab1503d2-e782-435f-a0db-63d1de5d9d59"}
info: <-- POST /wd/hub/session/ab1503d2-e782-435f-a0db-63d1de5d9d59/element 500 794.644 ms - 195
info: --> POST /wd/hub/session/ab1503d2-e782-435f-a0db-63d1de5d9d59/element

the command im using to find the element is:

from appium.webdriver.webdriver import WebDriver
from selenium.webdriver.support.wait import WebDriverWait

WebDriverWait(driver, timeout, delay, NoSuchElementException).until(lambda x: x.find_element_by_id('me.everything.launcher:id/done_btn'))

The main problem is that sometimes it finds the element and sometimes it doesn’t, its very inconsistent so i can’t put my finger on the exact problem.

I did check with android sdk uiautomatorviewer and i see the element on the xml output with the correct id.
Also, sometimes using the Appium mac client i see the element on the xml tree but i can’t find it using the search by id

Is there a fix or a workaround i can try to receive more consistent results?

Attached is the full appium log. appium.log (45.0 KB)

Thanks.

1 Like

I am now seeing this (inconsistent), and it may be related to Appium run from command line can't find element

Did you ever find a solution?

Hi, I am getting following error while executing Xamarin cloud test using JUNIT approach.
Session issue .NoSuchElementException: An element could not be located on the page using the given search parameters.

Please suggest me on this issue, what could be the issue.