Appium error : Matched W3C error code 'no such element' to NoSuchElementError

Hi ,

Can someone help me to fix this error
“Matched W3C error code ‘no such element’ to NoSuchElementError”

In my case I am not able to click on some elements like login page and etc . I have checked locators value are correct . I have added implicit and explicit wait time also. Not able to figure out why this error is coming for few pages objects only.

Adding few screenshots of my code






@Aleksei Could you please help me . I am stuck with execution . Mainly in login page I am getting this issue . If I use logged in app my rest code works. Not sure how to fix this issue

Add page source of problematic screen.

@Aleksei I am having issue in clicking login button
Here I have attached locators file and class having login function . Actually my application launch but don’t click on login button. It print this line too System.out.println(executionOS + " platform testing"); , first line of function



This is the object and locator from appium inspector for login button

Try with

@AndroidFindBy(uiAutomator = "new UiSelector().description(\"btn_login\")")

Tried but no luck . Still cannot find login object :frowning_face:

Add your code of click function.
Also update init of your pages with

// we limit search by 5 sec
  PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(5)), this);
}

@Aleksei Previously I tried with this too but doesn’t work

PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(5)), this);

Here is my click function


And still the error “element not found”?

@Aleksei Yeah same error. I am actually confused is it bcos of automation code or app has something to do at code level :thinking:

What this error is about?

image
There is something wrong. This is <> below

@AndroidFindBy(uiAutomator = "new UiSelector().description(\"btn_login\")")

Try:

  1. update init
PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(5)), this);
  1. make element like:
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"btn_login\")")
  1. update click to more simple function:
public void clickButton(Mobile ele) {
  ele.click();
}

What java-client and selenium versions in your code?

@Aleksei Here is what I added in pom.xml file

io.appium
java-client
7.3.0


org.seleniumhq.selenium
selenium-java
3.141.59

Updated for all 3 points mentioned by you but still not working , stucks at login page

need Appium server DEBUG logs. add link to https://gist.github.com/

Here I have attached code Server logs , failing to click on login button after app launch · GitHub
Please hep to check @Aleksei

you still sending

"strategy":"id","selector":"loginButton","context":"","multiple":false

Which not correct and obviously no such button found.

Somehow you sending loginButton variable name instead of variable itself!

Looks like problem is somewhere in second file ?


Can you advice how can I update it @Aleksei