Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. Solution
  2. The error Element is not clickable at point (x, y) can arise from different factors. You can address them by either of the following procedures:
  3.  
  4. 1. Element not getting clicked due to JavaScript or AJAX calls present
  5.  
  6. Try to use Actions Class:
  7.  
  8. WebElement element = driver.findElement(By.id("navigationPageButton"));
  9. Actions actions = new Actions(driver);
  10. actions.moveToElement(element).click().build().perform();
  11. 2. Element not getting clicked as it is not within Viewport
  12.  
  13. Try to use JavascriptExecutor to bring the element within the Viewport:
  14.  
  15. WebElement myelement = driver.findElement(By.id("navigationPageButton"));
  16. JavascriptExecutor jse2 = (JavascriptExecutor)driver;
  17. jse2.executeScript("arguments[0].scrollIntoView()", myelement);
  18. 3. The page is getting refreshed before the element gets clickable.
  19.  
  20. In this case induce ExplicitWait i.e WebDriverWait as mentioned in point 4.
  21.  
  22. 4. Element is present in the DOM but not clickable.
  23.  
  24. In this case induce ExplicitWait with ExpectedConditions set to elementToBeClickable for the element to be clickable:
  25.  
  26. WebDriverWait wait2 = new WebDriverWait(driver, 10);
  27. wait2.until(ExpectedConditions.elementToBeClickable(By.id("navigationPageButton")));
  28. 5. Element is present but having temporary Overlay.
  29.  
  30. In this case induce ExplicitWait with ExpectedConditions set to invisibilityOfElementLocated for the Overlay to be invisible.
  31.  
  32. WebDriverWait wait3 = new WebDriverWait(driver, 10);
  33. wait3.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("ele_to_inv")));
  34. 6. Element is present but having permanent Overlay.
  35.  
  36. Use JavascriptExecutor to send the click directly on the element.
  37.  
  38. WebElement ele = driver.findElement(By.xpath("element_xpath"));
  39. JavascriptExecutor executor = (JavascriptExecutor)driver;
  40. executor.executeScript("arguments[0].click();", ele);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement