Keamtiti B.
Keamtiti B.

Reputation: 11

My appium is founded the element but Cannot click element. it's say "Cannot click. The element is found but not visible on Screen"

i have following this code

            try{Thread.sleep(2000);} catch(Exception ignore){}
            w8_Dirty.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@text='Reject Inspect']")));
            Dirty.findElement(By.xpath("//*[@id='btnRejectDirty']")).click();

so i try to wait until element is enable but it won't work. it said

unknown error (An unknown server-side error occurred. status='false'. Failed to complete internal method: 'click args: [NATIVE, xpath=(//[@id='btnRejectDirty'])1, 0, 1]', details: Failed to click 'xpath=(//[@id='btnRejectDirty'])1'. Cannot click. The element is found but not visible on Screen) (WARNING: The server did not provide any stacktrace information)

what should i do?.
PS.I use java.

This is the element that i want to click it's show on the screen but my appium can't click

this image show that element can clickable

Upvotes: 0

Views: 1693

Answers (2)

Shubham Morbale
Shubham Morbale

Reputation: 11

TouchAction touchActions = new TouchAction(driver);

    touchActions.press(PointOption.point(100,1000))
    .waitAction(WaitOptions.waitOptions(Duration.ofSeconds(1)))
    .moveTo(PointOption.point(100, 50)).release().perform();

Scroll using this code

Upvotes: 1

Vault23
Vault23

Reputation: 753

I don't know what is actually happening on the screen and what element is enabled means, but here are my suggestions. Obviously, driver can not click on the element if it is not visible (you can see such reason in the log). You can scroll to it and then click on it with the following method:

public void scrollToElementByText(String text) {
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text(\"" + text + "\").instance(0))");
}

You can scroll to element by text or description for example. Other suggestion is that the elemnt is not clickable so you can not perform click() on it. To clarify that situation paste here some screenshot with DOM tree of this particular element in it.

Upvotes: 1

Related Questions