3

Hi all i am using selenium backed webdriver i am automating some third party site so i don't have any access to the code of that site problem is that my selenium test case works well firefox but when i use chromedriver it gives an exception Element is not clickable at point (693, 14). Other element would receive the click i read on some blog that using the lines of code makes the problem go the lines are given below

WebElement elementToClick = driver.findElement(By.id("create_item_button"));
((JavascriptExecutor)driver).executeScript("window.scrollTo(0," + elementToClick.getLocation().y + ")");
elementToClick.click();

But this does not help can any one suggest me any work around for that my code is as given below

            selenium.click("//img[@alt='Upload']");
    selenium.click("link=basic uploader");
            WebElement fileUpload = driver.findElement(By.id("file-box"));

    ((JavascriptExecutor)driver).executeScript("window.scrollTo(0,"+fileUpload.getLocation().y+")");

    Thread.sleep(1000);
    fileUpload.sendKeys("C:\\Users\\Shoaib\\Desktop\\kkk.java");
Antoine
  • 800
  • 3
  • 14
  • 29
Shoaib Ahmed
  • 157
  • 3
  • 15
  • Generally, it means that element you're trying to click is: a) moved to different position (e.g. animation); b) overlapped by some other element. If you can give an example of HTML and code you use, it'd be much easier to figure it out. – p0deje Dec 24 '12 at 06:33
  • I am using third party site which is https://www.box.com/ i am trying to click its create item button and i am using the same code to click that button in firefox it works fine but in chrome it gives that exception – Shoaib Ahmed Dec 24 '12 at 09:33
  • Do we have any other work arounds to deal with the issue other than the one i am using – Shoaib Ahmed Dec 24 '12 at 09:35
  • Just try the same code (in Ruby) and it worked ok for me using ChromeDriver 23.0.1240.0, Chrome 23.0.1271.101 and Selenium 2.27.1. Not sure why it doesn't work for you. – p0deje Dec 24 '12 at 13:49
  • here it is my code i am trying to upload file selenium.click("//img[@alt='Upload']"); selenium.click("link=basic uploader"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0,"+fileUpload.getLocation().y+")"); fileUpload.sendKeys("C:\\Users\\Shoaib\\Desktop\\kkk.java"); – Shoaib Ahmed Dec 24 '12 at 22:01
  • Possible duplicate of [Debugging "Element is not clickable at point" error](https://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error) – Mate Mrše Apr 24 '19 at 08:29

1 Answers1

0

You can move the mouse to the location of the element and then click, using actions:

Actions builder = new Actions(driver);   
builder.moveToElement([VisibleElementThatIsNearby], [XOffset], [YOffset])
    .click()
    .build()
    .perform();

where VisibleElementThatIsNearby is an element that you can identify with no problems, and XOffset is the amount left/right you need to move from there to click on the element, and YOffset is the amount up/down you need to move to click on the element.

Rescis
  • 547
  • 5
  • 19