org.openqa.selenium.NoSuchElementException: Can't locate an element by this strategy: Locator map:

Element is visible but still Appium is not tapping over any element available in that screen. Whereas I can able to access the elements in previous screen.

I’ve tried by all possible means

driver.findElementById(“AddNewFarmer”).click();
And using pageobjects too. Also tried with xpath, but still can’t able to access the element.
I tried with both Appium version 1.8 and 1.10. Please help me on this

Server log:

[HTTP] {“using”:“id”,“value”:“AddNewFarmer”} [debug] [MJSONWP] Calling AppiumDriver.findElements() with args: [“id”,“AddNewFarmer”,“c5acec26-3a1f-495a-a9c2-574ef2a17a69”] [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“AddNewFarmer”,“context”:"",“multiple”:true}} [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“AddNewFarmer”,“context”:"",“multiple”:true}} [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘AddNewFarmer’ using ‘ID’ with the contextId: ‘’ multiple: true [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.olam.digital.ofispreprod:id/AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.olam.digital.ofispreprod:id/AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0) [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.olam.digital.ofispreprod:id/AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=android:id/AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=android:id/AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0) [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=android:id/AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=AddNewFarmer] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)

=====================================================

Error log:

org.openqa.selenium.NoSuchElementException: Can’t locate an element by this strategy: Locator map: - native content: “By.id: AddNewFarmer” - html content: “by id or name “addNewFarmer”” For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: ‘2.53.1’, revision: ‘a36b8b1cd5757287168e54b817830adce9b0158d’, time: ‘2016-06-30 19:26:09’ System info: host: ‘INCHN-LAP960’, ip: ‘10.190.4.15’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_172’ Driver info: driver.version: unknown at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:110) at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:57) at io.appium.java_client.android.AndroidElement$$EnhancerByCGLIB$$c0b591f0.toString() at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at org.openqa.selenium.support.ui.ExpectedConditions$10.toString(ExpectedConditions.java:293) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:257) at com.olamnet.OFIS.utilities.ActionItems.waitAction(ActionItems.java:68) at com.olamnet.OFIS.commonActions.LoginEnumerator.loginWithValidEnumeratorId(LoginEnumerator.java:60) at com.olamnet.OFIS.stepDefinition.LoginEnumeratorStep.enter_a_valid_Enumerator_ID_and_verify(LoginEnumeratorStep.java:31) at ?.Then Enter a valid Enumerator ID and verify(EnumeratorLogin.feature:13)

Hi @Thamarai_Selvi, Have you used implicit wait here??

Hey @sachin925

Hey, tried several ways to find my element, error still shows up.

  1. From the below list , tried all locator strategy in Python , but no help.

#elu = driver.find_element_by_xpath("//*[contains(@text, ‘Baddebt Collection’)]")
#elu.click()

elv = driver.find_element_by_xpath(’//android.widget.TextView[@text= “Baddebt Collection”]’)
elv.click()

#elk = driver.find_element_by_name(“Baddebt Collection”)
#elk.click()

#el78 = driver.find_element_by_id(“com.ambs.mobile:id/txtValue_Spinner”)
#el78.click()

#elb = driver.find_element_by_xpath("//*[@name=‘Baddebt Collection’]")
#elb.click()

Hi,

I’m getting the same error while automating react native app, Any solution for this?
I tried @FindBy instead of @AndroidFindBy but still the same.
I’m using appium version 1.20.0. Can anyone please help with this?