1

Explicit wait is not woking in the below line diver is waiting for only 70 to 100 milliseconds and error is displayed as element is not clickable :

WebDriverWait wait1=new WebDriverWait(driver,5000);
wait1.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[@class='ui-button-icon-primary ui-icon ui-icon-triangle-1-s']")));
driver.findElement(By.xpath("//span[@class='ui-button-icon-primary ui-icon ui-icon-triangle-1-s']")).click();
Naman
  • 27,789
  • 26
  • 218
  • 353
dolittle
  • 310
  • 1
  • 5
  • 13

2 Answers2

1

Try to add :

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77
  • 1
    how to use explicit wait because some times elements is appearing quickly in that scenario if i use implicit wait or thread then driver is waiting uselessly – dolittle May 18 '16 at 07:34
  • 1
    check this one : http://stackoverflow.com/questions/12858972/how-can-i-ask-the-selenium-webdriver-to-wait-for-few-seconds-in-java – Emna Ayadi May 18 '16 at 07:38
1

In that case your Element is not clickable. Make sure the Xpath you are providing is correct.Consult the following question,make sure you are not making similar kind of mistake

How to resolve org.openqa.selenium.WebDriverException?

Community
  • 1
  • 1
Ssik
  • 96
  • 4
  • i am using a correct xpath because after thread.sleep the element is clicked – dolittle May 18 '16 at 07:35
  • 1
    In that case this is just a problem of wait time.Try to debug the code , If the element is clicked when debugging ,then try Thread.sleep(TimeinMilSec); In that case you will have to place an arbitrary sleep time which seems sufficient to click the element at any point. – Ssik May 18 '16 at 07:39