
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Element is Not Clickable at Point in Selenium
We can get the error - Element is not clickable at point while trying to click a link in Selenium webdriver. This is common in chromedriver as the Chrome browser determines an element with point location.
When the position of an element is changing and we make an attempt to click on it, this error is encountered. This is because the element is present in DOM, but its position is not fixed on the page.
There are some workarounds to fix this error as listed below −
Adding the explicit wait. The webdriver can wait till the expected condition - visibilityOf(webdriver shall wait for an element in DOM to be visible).
Adding the explicit wait. The webdriver can wait till the expected condition - visibilityOfElementLocated. The webdriver shall wait for an element to be present in DOM and displayed on the page.
Maximize the size of the browser.
Syntax
driver.manage().window().maximize()
Adding methods of the Actions class.
Syntax
WebElement l = driver.findElement(By.name("field-name")); Actions at = new Actions(driver); at.moveToElement(l).click().perform();
JavaScript Executor.
Syntax to get location along x axis −
WebElement l = driver.findElement(By.name("field-name")); JavascriptExecutor je =(JavascriptExecutor)driver; je.executeScript("window.scrollTo(0,"l.getLocation().x+")"); l.click();
Syntax to get location along y axis −
WebElement l = driver.findElement(By.name("field-name")); JavascriptExecutor je =(JavascriptExecutor)driver; je.executeScript("window.scrollTo(0,"l.getLocation().y+")"); l.click();