Locator is not working except id on the Appium for Android in WebView Locator is not working except id on the Appium for Android in WebView selenium selenium

Locator is not working except id on the Appium for Android in WebView


I didn't work with Appium for a long time, so maybe I'm wrong, but as I remember, Appium supports locating elements by id or xpath only.
So, instead of findElementByName try findElementByXpath.
The locator should be changed accordingly, so it will be something like

WebElement LoginButton = appiumdriver.findElementByXpath("//*[@name='end']");


I have done certain changes to the code.

Changed Appium Server to 1.10 to 1.20.2.Used Android Driver Instance.

Also, Used the Xpath for the non-ionic framework.

It resolved the issue for me and I am able to locate the element using this.

        WebElement UsernameElement = appiumdriver.findElementByXPath("//*[@id=\"username\"]/input");        Thread.sleep(1000);        UsernameElement.click();        Thread.sleep(1000);        UsernameElement.sendKeys("mobile3@20212.com");

Maybe the Old Appium was not able to identify the element.