title: Wanted to click on android element using appium by providing xpath
body: <p>I have a  button onclick event , however, when it is run, in reality, the button is not actually clicked.When I do .isDisplayed(), the element is always found.  however, still the test fails.
  Here i wanted to click on Not now button but in following code didn't work ,
  what should i do ?</p>
  
  <pre><code>     WebElement c=driver.findElement(By.xpath("//android.widget.Button[@resource-id='android:id/button2']"));
              if(c.isDisplayed())
              {
                  c.click();
              }
      Thread.sleep(20000);
  
  
      driver.findElement(By.xpath("//android.widget.EditText[@text='Email']")).sendKeys("testappium@gmail.com");
  </code></pre>
  
  <p>i also tried  following code but i didn't work</p>
  
  <pre><code>driver.findElement(By.xpath("//android.widget.FrameLayout[@bounds='[27,724][1053,1267]']/android.widget.FrameLayout[@bounds='[75,772][1005,1219]']/android.widget.FrameLayout[@resource-id='android:id/content']/android.widget.LinearLayout[@resource-id='android:id/parentPanel']/android.widget.LinearLayout[@resource-id='android:id/buttonPanel']/android.widget.Button[@bounds='[517,1063][777,1207]']")).click();
  </code></pre>
  
  <p>also tried following code:</p>
  
  <pre><code>driver.findElement(By.xpath("//*[@class='android.widget.Button' and @bounds='[517,1063][777,1207]']")).click();
  </code></pre>
  
  <p>error which i'm getting is :</p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
  For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
  
  *** Element info: {Using=xpath, value=//android.widget.EditText[@text='Email']}
  
  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
      at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
      at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
      at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
      at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
      at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
      at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
      at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
      at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:152)
      at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
      at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
      at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
      at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
      at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
      at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
      at execution.AppTest.main(AppTest.java:183)
  </code></pre>
  
  <p>UI Automator Viewer:</p>
  
  <p><a href="https://i.stack.imgur.com/3cmcY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3cmcY.png" alt="UI Automator Viewer"></a></p>