简体   繁体   中英

Appium not clicking on an element

I'm trying to automate one of my hybrid app using Appium . I'm getting an issue while clicking on the Login button. The error message I'm getting is:

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (116, 329). Other element would receive the click: <button class="button button-medium button-custom-login " ng-click="login()">...</button>

And I just want to click on the same element ie the one mentioned here with attribute ng-click="login() .

I've changed the context already to WebView and tried with changing the attribute to Native as well but nothing seems to be working.

The code which I've used to identify this element is below:

List<WebElement> labels = driver.findElementsByTagName("button");

I iterated through all the elements and found that I need to click on number 20 element.

Any help on this would be great. Thanks!

You should try using Actions class as below :-

WebElement element = driver.findEle....
Actions action = new Actions(driver);
action.moveToElement(element).click().perform();

If you have found that you need to click on number 20 element in the list, you could go this way:

int pos = 20;
List labels = driver.findElementsByTagName("button");
labels.get(pos-1).click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM