I am trying to click on the button using selenium on my ionic cordova application. I tried click(), javascript, tap but nothing work.
Can anyone please take a look and suggest. I have attached the screenshot.
Error coming when tried with span.
I am trying to click on the button using selenium on my ionic cordova application. I tried click(), javascript, tap but nothing work.
Can anyone please take a look and suggest. I have attached the screenshot.
Error coming when tried with span.
As you have highlighted it may be a bit difficult to click on the <button>
tag. Hence you can try to click on the inner <span>
tag as follows:
WebElement ele = driver.findElement(By.xpath("//button[@class='btn-done disable-hover bar-button bar-button-md bar-button-default bar-button-default-md']/span[@class='button-inner']"));
ele.click();
Now as you are seeing a WebDriverException: Element is not clickable at point (--, --)
. It can happen for a number of reasons as discussed in this Discussion
. So we will use the JavascriptExecutor
click as follows:
WebElement ele = driver.findElement(By.xpath("//button[@class='btn-done disable-hover bar-button bar-button-md bar-button-default bar-button-default-md']/span[@class='button-inner']"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", ele);