I was very happy when I was working with Firefox on Windows, but in my organization, I came across through a requirement where I had to execute test case mainly on Chrome browser. I faced Element is not clickable at point in Selenium and I solved using different ways.
If you want to start working with chrome then check below post to see how to work with Chrome browser.
How to execute Selenium Testcase in Chrome browser
I started automating test case and most of the test cases was working fine, but some of the test cases were failing due to below exception.
Element is not clickable at point in Selenium
I have seen a couple of exception while working with Selenium but this was a new exception for me so I was not sure how to solve this.
I have collected some of frequent occurring exception in Selenium, which might help you.
Different Scenario of Selenium Exception
I started debugging my test cases, tried so many hit and trial, and finally found some of the solutions so thought will share with others too.
The reason for the element is not clickable at point(x,y) exception.
Some of my observation was
- It mostly happens in Chrome so if you are mostly working with Firefox or IE then you will not be getting this exception.
- Chrome does not calculate the exact location of element
- Chrome always click in the middle of Element.
- Sometimes you will get this exception due to Sync issue also.
YouTube Video for same
Solution that worked for me to Solve element is not clickable at point(x,y) exception
1-Updated chrome driver to latest one 2.15
2-Get the coordinate then click on the link or button
3-Try to click using Y coordinates
// Find an element WebElement elementToClick = driver.findElement(By.xpath("Your xpath")); // Scroll the browser to the element's Y position ((JavascriptExecutor)driver).executeScript("window.scrollTo(0,"+elementToClick.getLocation().y+")"); // Click the element elementToClick.click();
4-Try to click using X coordinates
// Find an element WebElement elementToClick = driver.findElement(By.xpath("Your xpath")); // Scroll the browser to the element's X position ((JavascriptExecutor)driver).executeScript("window.scrollTo(0,"+elementToClick.getLocation().x+")"); // Click the element elementToClick.click();
Selenium has a large number of option to handle single thing in multiple ways so in case you are facing any issue feel free to reach out. Comment below for any suggestion and feedback.
Keep visiting, have a nice day J
For More updates Learn Automation page
For any query join Selenium group- Selenium Group
Shristi says
Hi Mukesh,
On the URL, http://demo.automationtesting.in/Register.html , I want to click on “choose file ” option , but I’m not able to do so even using JavaScript.
Can you please help.
Mukesh Otwani says
Hi Shristi,
If you inspect Choose File element, then you would be <input tag along with type='file' and this attribute allows you to upload files without clicking on Choose File button. You can use this statement driver.findElement(By.xpath("//*[@id='imagesrc']")).sendKeys("your_file_path");
Please refer initial part of this link https://learn-automation.com/upload-file-in-selenium-webdriver-using-robot-class/
Siddesha B B says
hii Mukesh ,
pls give me code to click of More Options: Class of Travel,Airline Preference of given url https://www.cleartrip.com/ . Tried many ways but not able to click.
Thanks in advance
Mukesh Otwani says
Hi Siddesha,
Xpath ->> //*[local-name()=’strong’ and text()=’More options:’] worked for me.
Rajatha says
Thank you so much Mukesh. Above solution worked for me.
Mukesh Otwani says
Cheers Rajatha
Sheetal says
hii pls give me code to click of Signin button of given url (https://dayswappers.org/login)
as i tried with many codes
Mukesh Otwani says
Hi Sheetal,
I’ve tried with xpath //button[text()=’Sign In’] and it worked well.
Perron Firmin says
Hello Dear Mukesh,
I hope you are well. I sent you a message by your E-mail about the last suggestion.
Thanks in advance,
Perron,
Mukesh Otwani says
Hi Perron,
I could not find any email. Let’s have a call for quick discussion.
Thanks
Mukesh Otwani
Perron Firmin says
Hello dear Mukesh,
Many thanks for your response. I sent you an e-mail. But I would like to write the code to manage next page click.
I see this program that makes the same things I want to make :
def scrape():
driver = webdriver.PhantomJS()
driver.get(‘http://quotes.toscrape.com/js-onclick’)
while True:
sel = parsel.Selector(text=driver.page_source)
for quote in sel.css(‘div.quote’):
print({
‘text’: quote.css(‘span.text::text’).extract_first(),
‘author’: quote.css(‘span small::text’).extract_first(),
‘tags’: quote.css(‘div.tags a.tag::text’).extract(),
})
try:
next_button = driver.find_element_by_css_selector(‘li.next > a’)
next_button.click()
except NoSuchElementException:
break
When I make inspect on this URL, I get the following code for next button :
Next →
for my context, I don’t know how to select the element for the next page button click. You can see my code after inspect on my URL.
›
Page suivante
PLEASE, help me to fix this.
Many thanks,
Mukesh Otwani says
Hi Perron,
Please try below xpath
//li[@class=’next’]//a
//li[@class=’next’]
If above xpath is not working then we can try JavaScriptExecutor
Mukesh Otwani says
Sure Perron you can mail me your queries at mukeshotwani@learn-automation.com
Gaurav Khurana says
I also got this problem . But it got solved by just maximizing the window. Sometimes that also works.
Mukesh Otwani says
Thanks Gaurav I will update this as well.
Soheil says
hi Mukesh,
i have tried sooo many things but cannot continue as i am getting the error ” is not clickable at point (1811, 300). Other element would receive the click:…”
i have tried with:
1. add implicit wait (implicitlyWait(timeout, TimeUnit.SECONDS);
2. use action with offset
3. use javascriptexecutor with offset (scroll-to)
4. execute java script with javascriptexecutor (executeScript(“document.getElementByxpath)
only way it worked was (but not permanentely)
– ((JavascriptExecutor) webDriver).executeScript(“document.getElementById(‘unique ID of MYBUTTON’).click();”);
– my button does not have id. i added ID during runtime in chrome inspector (F12)
could you please help me? Invensting now 2 days cannot continue with all solutions.
Mukesh Otwani says
Hi Soheil,
Try with dynamic xpath. Each application contains its own library for different controls. Locate parent or child tags and do same operation.
Soheil says
Hello Mukesh,
thanks for your response. with dynamic xpath you mean something like this, right:
webDriver.findElement(By.xpath(“//*[@class=’xxclass Tagxx of MYBUTTON’]”)).click();
I have used the inspector in Chrome to locate the parent tags and also tried to click on them but no outcome. my element does not have an ID and i cannot influence the implementation.
Is there a way to click on an Element through javascriptexecutor to a control which has not an ID? I mean using javascriptexecutor with an xpath?
Because this worked: I defined during runtime (in debug mode) an ID to the control with the chrome inspector and this line:
((JavascriptExecutor) webDriver).executeScript(“document.getElementById(‘test’).click();”);
I tried with this and it says: no such function named getelementbyxpath.
StringBuffer javaScript=new StringBuffer();
javaScript.append(“document.getElementByxpath(“”);
javaScript.append(“/html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div[1]/ul/li/catalog-product/div/div[2]/div[1]/div”);
javaScript.append(“”).click();”);
JavascriptExecutor executor = (JavascriptExecutor)webDriver;
String javaScriptText = javaScript.toString();
executor.executeScript(javaScriptText);
Hope i am not providing tooo much information and confuse…
thanks so far.
bye
Mohammad
Mukesh Otwani says
Hi Soheil,
Try this
WebElement elem = webDriver.findElement(By.xpath(xpath));
String js = “arguments[0].style.height=’auto’; arguments[0].style.visibility=’visible’;”;
((JavascriptExecutor)ldriver).executeScript(js, elem);
elem.click();
ElementHighlight.higtLight(ldriver, lxpath);
Soheil says
Hi Mukesh,
really appreciate your help. Thanks!
with this below i get an exception:
WebElement elem = webDriver.findElement(By.xpath( “//*[@class=’ng-binding’]”));
String script = “arguments[0].style.height=’auto’; arguments[0].style.visibility=’visible’;”;
((JavascriptExecutor)webDriver).executeScript(script, elem);
clickableAddProduct.click();
Exception message: unknown error: Runtime.evaluate threw exception: SyntaxError: Invalid or unexpected token
at line 3 (JavaScriptExecutor line)
Mukesh Otwani says
Hi Soheil,
Call elem.click() instead clickableAddproduct.click();
Raveendra says
Hi Mukesh,
Hope you are doing Great,
Thanks for sharing Your knowledge with us,
I am following Your selenium videos its Really nice and clear&Well Explained Each and every point
I am NEW to selenium so,
I have a Question
Can we perform KeyBoard API (like downloading a file by using TAB operations) using PageObjectModel, i am able performing the DROPDOWNS so i just want to confirm weather we can r not,
Thanks&Regards,
Raveendra
Mukesh Otwani says
Hi Raveendra this will guide http://learn-automation.com/selenium-advance-activity/
Akash says
Hi mukesh, facing same issue Element is not clickable at point (514.5, 11.866668701171875). Other element would receive the click: . please reply to resolve, i have send you my script one week ago Awaiting for your reply.
Mukesh Otwani says
Hi Akash,
I have video for this https://www.youtube.com/watch?v=XNwcGNLk3cE&t=1s
priya says
Hi,
I use the same code to click on one button after clicking it should open the form, its not opening the form and also its not throwing any error, how to solve such problem
Mukesh Otwani says
Hi Priya,
Please try in different browsers.
surjit singh says
I also faced the same issue.
I downgraded selenium jar to 2.46 and this issue was gone.
Mukesh Otwani says
Great Surjit
Anju says
Hi Mukesh,
I am new to Selenium in learning stage,i found most of your post helpful but stucked in the following exception.I tried all the possibilities suggested by you, still not able to click on calender to select the date.
I am sharing my code, pls help
WebElement elementToClick = driver.findElement(By.xpath(“.//*[@id=’vfb-8′”));
((JavascriptExecutor)driver).executeScript(“window.scrollTo(0,”+elementToClick.getLocation().x+”)”);
elementToClick.click();
I am using Google Chrome version 54.0.2840.59
Mukesh Otwani says
Hi Anju,
Can you share your scripts as well?
Rekha says
Hi Mukesh, I am encountering the same error = System.InvalidOperationException : unknown error: Element is not clickable at point (752, 237).
when I click on a link in Chrome browser. Can you please let me know the IJavaScriptExecutor syntax for the same in C#
Mukesh Otwani says
HI Rekha,
Sorry I am not good in c# but I can give you suggestion that try some other xpath which will match with single node.
prashant jha says
Sir, I am getting the error ” Element is not clickable at point (958, 7) in firefox ” Sometime it is working and sometime it is showing the above .can you give me the solution how to fix it?
Mukesh Otwani says
Hi Prashant,
It mostly happens when click method is not clicking on middle of element. Can you send me ur code to my email so that I can check mukeshotwani@learn-automation.com
Bimlesh says
Hi Mukesh,
Kindly advise on this issue.
Scenario: Login successfully to http://www.homeshop18.com and then choose “Samsung” from “Digital” Menu. The results are displayed and now from the “Brand” section (displayed at the left side of the page), I need to choose another brand called “Micromax” by SROLLING.
I am trying to achieve this but no luck so far.
My code:
public void Browse_Samsung() throws Exception
{
WebDriverWait wait = new WebDriverWait(driver, 30);
Actions act = new Actions(driver);
act.moveToElement(Digital_Menu).perform();
act.click(wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(“//*[@id=’CategoryMenu1′]//a[@title=’Samsung’]”)))).build().perform();
WebElement Micromax = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(“//*[@id=’filter_1Option_21′]//a[@title=’GSM Mobile Phones – Micromax’]”)));
((JavascriptExecutor)driver).executeScript(“window.scrollTo(0,”+Micromax.getLocation().x+”)”);
Micromax.click();
}
Error:
org.openqa.selenium.TimeoutException: Timed out after 30 seconds waiting for visibility of element located by By.xpath: //*[@id=’filter_1Option_21′]//a[@title=’GSM Mobile Phones – Micromax’]
Build info: version: ‘2.53.1’, revision: ‘a36b8b1cd5757287168e54b817830adce9b0158d’, time: ‘2016-06-30 19:26:09’
Mukesh Otwani says
Hi Bimlesh,
Can u send me complete program which will help me to fix this issue.
Manasi says
I am facing the same issue in FF, but only when I am using xpath. It works fine when I am using the link text.
Mukesh Otwani says
Hey Manasi,
Thanks and good observation 🙂 Have you tried proposed solution which I mentioned in my blog?
shruthi says
Hi Mukesh,
Really your code helped me.I am trying to solve my problem from 2 days.but couldn’t do it.
Thankyou so much.I am just beginner.Could you please explain me why we should use Java script in that code?
Mukesh Otwani says
Hey Shruthi,
Java Script can forcefully click on Specific element which java can not do 🙂
Zaher says
I have had this problem on FF. This issue happens when your field is not in the view area. The slick way to resolve this issue is to zoom out your browser:
TheNotClickableField.SendKeys(Keys.Control + “-” + “-“);
you might want to zoom out more or less according to your page size.
Mukesh Otwani says
Thanks Zaher 🙂
Hemant says
I’m facing same issue in Firefox 44.0.2. Our Python automation is not able to click on the “Give Away” button to test the giveaway page of goodreads.com. Please Help.
Mukesh Otwani says
Hi Hemant,
First perform mouse hover and then click on Button. This solution always worked for me.
Guna says
Hey I am unable to click on button in firefox but if try to click manually it is working but with selenium it showing below error
lement is not clickable at point (1100, 22). Other element would receive the click.
i have tried y coordinates thing but it doesn’t work. Please help me on this.
Mukesh Otwani says
Hi Guna,
MoveToElement approach always works for me 🙂
Alex says
Thanks, this article helped me out!
Deepak says
Hey I am unable to click on button in firefox but if try to click manually it is working but with selenium it showing below error
lement is not clickable at point (77, 590). Other element would receive the click.
i have tried the x and y coordinates thing. Please help me on this.
Mukesh Otwani says
Is this solved?
Łukasz says
Everywhere it is written that this issue occurs only in Chrome. I use Firefox and I also had this problem. But your solution helped me. Thx a lot 🙂
Mukesh Otwani says
Hi Lukasz,
Glad to know it worked for you. Cheers
Rafael Carvalho says
Hello,
I was having problem running my UI tests inside a windows service application (Bamboo Server), and now after doing what you suggested everything is working good!
Many thanks!!!
(I am using Firefox driver)
Mukesh Otwani says
Hi Rafael Carvalho,
Glad to hear it helped you. Keep visiting 🙂
Janet Frank says
I am also having this issue. I am using Java but when I add the JavaScriptExecutor to my code I do not get the method executeScript added. I am not sure what is happening here. As stated above my code us working fine for Firefox and Edge.
Mukesh Otwani says
Hi Janet,
Please make sure JavaScriptExecutor which you imported is coming from Selenium library or not?
If not then please import the correct package and try again.
Let me know if still facing the same issue then I will login and fix this.
G Derilus says
Hey with Selenium 2.48.2 release firefox is acting the save way can you update this article – This very useful article! thank you!
Mukesh Otwani says
Hi Derilus,
Thanks for keep me updated. I will update the article too 🙂