Skip to content
This repository has been archived by the owner. It is now read-only.

Chrome - Element is not clickable at point #2766

Closed
lukeis opened this issue Mar 3, 2016 · 101 comments

Comments

@lukeis
Copy link
Member

@lukeis lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2766

Selenium Webdriver for C#: 2.11.0
ChromeDriver.exe: 16.0.902.0
Chrome: 15.0.874.106 m

Is anyone else seeing this?

EXPECTED: Webdriver to click the link in Chrome

ACTUAL:
System.InvalidOperationException : Element is not clickable at point (326, 792.5)

Reported by jaemzware on 2011-11-03 13:47:28

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Reported by barancev on 2011-11-04 21:33:36

  • Labels added: Component-WebDriver, Browser-Chrome
@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Can you give a reproducible test case? Or a link to a public page where the problem
occurs?

Reported by kkania@chromium.org on 2011-11-08 17:37:00

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I can't give out credentials to the site, nor find an example online.  Essentially they're
span tags embedded in anchors (<a...><span...> ... </span></a>), and I'm trying to
click the span.  It works in FF and IE, and some cases in Chrome; however, I have not
been able to track down the distinction for the non-working case.

I've since worked around the issue by navigating directly to the href of the parent
anchor of the span.
driver.Navigate().GoToUrl(driver.FindElement(By.Id(embeddedSpanIdToClick)).FindElement(By.XPath("..")).GetAttribute("href"));

Thank you for the followup.

Reported by jaemzware on 2011-11-08 17:57:33

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Oh, and FYI this is running remote to a Virtual Machine.

Reported by jaemzware on 2011-11-08 18:13:41

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I can reliably trigger an 'Element is not clickable at point' exception with the attached
Python script.

$ python 2766_script.py 
Traceback (most recent call last):
  File "2766_script.py", line 13, in <module>
    main()
  File "2766_script.py", line 9, in main
    link.click()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py",
line 45, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py",
line 194, in _execute
    return self._parent.execute(command, params)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py",
line 153, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py",
line 126, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'Element is not clickable
at point (46, 622). Other element would receive the click: <li id="y1990s" class="ui-tabs-panel
ui-widget-content ui-corner-bottom">...</li> (WARNING: The server did not provide any
stacktrace information); duration or timeout: 203 milliseconds\nBuild info: version:
\'2.11.0\', revision: \'14431\', time: \'2011-10-28 16:27:42\'\nSystem info: os.name:
\'Windows XP\', os.arch: \'x86\', os.version: \'5.1\', java.version: \'1.7.0\'\nDriver
info: driver.version: RemoteWebDriver' ; Screenshot: available via screen ; Stacktrace:
Method newInstance0 threw an error in None 


Environment information:

Python library: 2.11.1
Chromedriver: 16.0.920.0
selenium-server-standalone-2.11.0.jar on Mac OS X 10.6.8 and Windows XP

Reported by sum1abi on 2011-11-10 15:52:48


- _Attachment: [2766_script.py](https://storage.googleapis.com/google-code-attachments/selenium/issue-2766/comment-5/2766_script.py)_
@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Thanks for the reproducible case. ChromeDriver always clicks the middle of the element
in attempt to be faithful to what an actual user does. However, in your case, if you
open Chrome and navigate to http://www.freelancersunion.org/about/index.html, you'll
notice the link '1990s' is not clickable in the middle.

There are two ways to handle this currently:
1) Change/fix the page so that the user can click on the link in the middle.
2) Use the advanced user interactions API to click at the appropriate place in the
link. e.g.,
ActionChains(w).move_to_element_with_offset(link, 0, 20).click().perform()

I suppose most of the 'Element is not clickable at point' errors are due to the link
not actually being clickable in its middle. To check, open Chrome's developer tools
via Inspect Element and hover over the element that is being clicked. Check that the
middle of the bounding box that appears is actually clickable.

I'm going to mark this as WontFix. If you can find a reproducible case where the element
is actually clickable by the user at the middle, please reopen this bug.

Reported by kkania@google.com on 2011-11-15 21:48:08

  • Status changed: WontFix

- _Attachment: click.png
![click.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-2766/comment-6/click.png)_
@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Here is my use case that produces the same "Element not clickable" error

1) I  have a page that have a link and a div in front of the link.
2) Without doing anything with the div, I can use xpath to find the link and it is
clickable.
3) Now if I hide that div, the same xpath still finds the link but the link becomes
not clickable.
4) Same code works for FF and IE.
5) My guess is that Chrome driver doesn't calculate the correct screen location of
link.

Reported by quyong2000 on 2011-12-05 17:43:07

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I'm having a legitimate error that I think is selenium's fault, not chrome's
I'm referencing an anchor inside a div. I know it is the webelement I'm interacting
with because I can get_attribute its href
I'm getting an error "Other element would receive the click, and it references the
parent div
This parent stretches across the page, so of course, chrome clicking in the middle
of it is not going to properly select the link.

Hardcoding coordinates is an absolutely horrible solution for writing non-brittle tests.
This needs to be investigated and fixed.

Reported by titus.fortner@tippr.com on 2011-12-06 16:39:08

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Also, issue 2750 is probably the same as this.

Reported by titus.fortner@tippr.com on 2011-12-06 16:42:05

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I guess the issue with clicking element may have something to do with element is not
in the current view. For my case, following code makes it work

                Capabilities cp = ((RemoteWebDriver) driver).getCapabilities();
                if (cp.getBrowserName().equals("chrome")) {
                    try {
                        ((JavascriptExecutor) driver).executeScript(
                                "arguments[0].scrollIntoView(true);", webElement);
                    } catch (Exception e) {

                    }
                }

                webElement.click();



Reported by quyong2000 on 2011-12-06 18:13:37

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Disregard my comment. Looks like there was an asynchronous call on my page that moved
my object into place(faster than I noticed). I'm guessing means the center was different
between when Chrome found it and clicked it.

Reported by titus.fortner@tippr.com on 2011-12-06 20:18:15

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This problem has become a nightmare for me after upgrading chromedriver.exe from 16.0.902.0
to 18.0.1022.0. Sometimes it works all fine and sometimes i get this exception

org.openqa.selenium.WebDriverException: Element is not clickable at point (849.5, 120.5).

Its kind of hard for me to maintain stability of the script as its intermittent 

Reported by aditya.dhingra89 on 2012-02-24 06:01:11

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

If you have a small test page that reproduces this problem (even if only occasionally)
that you can share, that would be helpful.

#12, I don't see any reason why it should fail intermittently, unless if the element
moves when ChromeDriver attempts to click it. This could happen, e.g., if an ad pops
up on the page and causes the link to be pushed down all of a sudden. To test, you
could try logging the location of the element repeatedly and see if it ever changes.
If the problem only occurs very rarely, I'd catch the WebDriver exception thrown by
the click, and in the exception log the location of the element again. You can compare
the location where ChromeDriver attempted to click and the current location of the
element, which will let you know if the problem is because the element moved. If that
is the case, you need to wait for the page to be fully loaded, or try clicking again,
or we need to change the way clicking works in ChromeDriver.

Also, see more details about the problem here: http://code.google.com/p/chromedriver/wiki/TroubleshootingAndSupport

Reported by kkania@google.com on 2012-02-24 17:16:38

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

yes you are right! The position of the element changes as the page starts loading, so
what i am doing is adding explicit wait before clicking the element so that the page
gets loaded, but believe me its really not possible to add explicit waits before all
such elements with which i face this problem.
Note: I never ever faced this problem with chromedriver.exe 16.0.902.0 .

Is there any change in the way clicking works in ChromeDriver after chromedriver.exe
version 16.0.902.0 ? 

I was totally relying on implicit waits till now , but after upgrading my chromedriver.exe
to 18.0.1022.0 , things are not like they were. 

I don't have any public url on which i can reproduce the same issue. But i think either
its about implicit wait for page load or the way chrome driver is clicking on the element.

And what i think is that its something related to implicit wait for page load because
i am getting these stale element exceptions quite frequently after upgrade 

org.openqa.selenium.StaleElementReferenceException: getElementTagName execution failed;

They are intermittent too.

And again i had to add explicit waits.

Reported by aditya.dhingra89 on 2012-02-27 09:48:43

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

See the changes between the two versions here:
http://build.chromium.org/f/chromium/perf/dashboard/ui/changelog.html?url=%2Ftrunk%2Fsrc%2Fchrome%2Ftest%2Fwebdriver&range=104253%3A119625&mode=html

I don't see any significant changes in clicking between the two. You may want to star
the following issue: http://code.google.com/p/chromedriver/issues/detail?id=22

Reported by kkania@google.com on 2012-02-27 17:59:21

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Is it possible that the time difference between finding an element and performing action
on it is bit large which might cause both the problems 

1 Change is position of element 
2 Reference to the element might go stale in that duration due to some change in DOM.

Either this or its too fast that it tries to find element before the DOM is in stable
state and page is fully loaded , but when it performs action due to change in DOM it
throws the above mentioned exceptions.

But the above mentioned enhancement would be great. Hope it solves the problem .

Reported by aditya.dhingra89 on 2012-02-29 07:17:54

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Hi,

I am having the same issue: 

Element is not clickable at point (69.5, 677.5). Other element would receive the click:
<div id="background">...</div> (WARNING: The server did not provide any stacktrace
information) Command duration or timeout: 125 milliseconds Build info: version: '2.17.0',
revision: '15540', time: '2012-01-16 16:51:46' System info: os.name: 'Windows 7', os.arch:
'x86', os.version: '6.1', java.version: '1.6.0_30' Driver info: driver.version: RemoteWebDriver
Command duration or timeout: 904 milliseconds Build info: version: '2.17.0', revision:
'15546', time: '2012-01-16 17:11:34' System info: os.name: 'Linux', os.arch: 'amd64',
os.version: '2.6.32-5-amd64', java.version: '1.6.0_26' Driver info: driver.version:
RemoteWebDriver

This error is very inconsistent (it appears in 1 out of 5 runs). In FF and IE works
perfectly.
The issue appears after an image is loaded on the page and the element position is
moved.
Do you have a solution for this?

Thanks, 
Bogdan

Reported by mielummu on 2012-03-07 16:53:28

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

The best way to currently avoid this problem is to wait for the element to stop moving
(wait for the page or image to finish loading in your case).

You may want to star http://code.google.com/p/chromedriver/issues/detail?id=28 and/or
http://code.google.com/p/chromedriver/issues/detail?id=22 which would make this issue
go away.

Also, see http://code.google.com/p/chromedriver/wiki/TroubleshootingAndSupport for
more info.

Reported by kkania@chromium.org on 2012-03-07 17:41:14

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Hi,

Thanks for the fast reply. I've tried to wait for the page to load (the issue appear
after loading an image and also after removing the image - this causes the element
to 'move') and it didn't work. Only with getLocation() method it seems stable, but
this also fails sometimes (so far it failed only once in about 50 runs - acceptable
but not a solution)

Regards,
Bogdan

Reported by mielummu on 2012-03-08 14:40:26

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Besides waiting for the page to load, you should wait for the image to be removed and
any other event which is causing the element position's to change. This sometimes can
be difficult, which is why you might be interested in the two feature requests logged
on the chromedriver site I mention above. If you can guarantee that the element is
no longer moving, clicking should work, even if it needs to scroll to do so.

Reported by kkania@google.com on 2012-03-08 19:03:37

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Here is a simple example with google search which works with IE and Firefox, but fails
with Chrome :

OpenQA.Selenium.Chrome.ChromeDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver();
driver.Navigate().GoToUrl(@"http://www.google.com");
driver.FindElementByName("q").SendKeys("Eiffel tower");
System.Threading.Thread.Sleep(1000);
driver.FindElementByName("btnG").Click();
 KO : Element is not clickable at point (450, 268)

When the text to search is typed, a dropped down list is created and it moves the search
button.

Reported by florentbr on 2012-03-12 01:02:27

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I upgraded chromedriver from 
version=14.0.836.0
to 
version=19.0.1068.0
and I keep getting the following error.
org.openqa.selenium.StaleElementReferenceException: getAttribute execution failed;
The page I am loading has multiple Ajax calls. The Same code works with Firefox which
indicates something wrong with the new version of chrome driver.
All test cases were working fine earlier for Chrome.

Any ideas how to fix this ? 
Or should I roll back to older chromedriver version.


Reported by reddymails on 2012-04-24 16:26:36

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I am getting the same error using version 19

OpenQA.Selenium.StaleElementReferenceException: isDisplayed execution failed;
 Element does not exist in cache

Reported by alister.scott on 2012-04-27 03:50:07

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I had this problem too:

WebDriverException: Message: u'unknown error: Element is not clickable at point (686,
713). Other element would receive the click: <div id="cab-wrapper" style="width: 700px;
display: block;">...</div>\n  (Session info: chrome=37.0.2062.122)\n  (Driver info:
chromedriver=2.10.267517,platform=Mac OS X 10.9.3 x86_64)'

The same tests pass using Safari, Firefox, and IE drivers. 

Tried most of the fixes described here: (i) scrolling to the element on the page, (ii)
changing the z-index of the element, (iii) off-setting the click by a few pixels, (iv)
changing the locator to using an id or css selector. None of these fixes worked for
me: what finally *did* work was just finding the element by whatever means I wanted
(xpath/class/css/id/etc) and then executing the Javascript click command:

self.browser.execute_script("arguments[0].click();", btn)

Hope this helps!

Reported by corinne.hutchinson on 2014-09-23 22:44:07

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I am experiencing this as well. Using execute_script worked for me as corinne described.


I can't speak for everyone's case, but the issue I'm experiencing is my webdriver code
is executing before page is completely set up. If I run the test cases manually on
a loaded page, everything works fine. If I run the test suite full speed, which loads
the page and immediately clicks, I get this error. I suspect that using the script
works because it defers clicking the element long enough for the document to be ready.

In my case, the page uses the jQuery BlockUI plugin (http://malsup.com/jquery/block/)
to simulate a modal by positioning a div over the entire page. When this error occurs,
the element webdriver complains about is the div added by the BlockUI plugin.

Reported by brent.atkinson on 2014-10-06 20:25:29

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I can confirm this bug and the workaround to use JavaScript. It's a very annoying thing...
:(

Reported by schuettecarsten on 2014-10-27 16:38:11

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Have tried all the means, jsexecuter, actions class, nothing helped.
Finally Thread.sleep worked but as you all know it is not preferred. 
Surely this should be a bug.

Any solutions will be greatly appreciated.

Reported by Ahsan@baublebar.com on 2014-10-27 19:04:25

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Its really annoying ...Pls help me out of this ,...

Reported by nor.dhinesh16 on 2014-11-13 13:09:12

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Make sure the element is in view, then click it using native actions,
worked for me, but one of them on thier own did not work.

Reported by paulmurphy105 on 2014-11-18 13:46:34

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Run into the same issue. Please look at the picture attached
It feels like a wrong assumption is made which element is on the top based on z-index.

There is a gray "background" which has z-index=999 and a pseudo-modal overlay dialog
which has z-index=1000. 
All elements inside the latter are on the top of the first, but since they have no
their own z-index it is assumed to be under the background.

Unfortunately I have no access to the site code to make corrections in order check
the guess. Will update this later

Reported by vchernoivan on 2014-11-25 15:20:31


- _Attachment: Selection_010.png
![Selection_010.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-2766/comment-91/Selection_010.png)_
@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Hi!
In my js page, I had this code:
$('body').css('cursor', 'wait');
before the processing in this page starts.
and then this:
$('body').css('cursor', 'default');
after the processing is complete.

Like a lot of people told in the forum, to wait till this page load completes.
So i tried this, 
(new WebDriverWait(driver, 10))
        .until(new ExpectedCondition<Boolean>() {
            public Boolean apply(WebDriver d) {
                WebElement elm =  driver.findElement(By.tagName("body"));
                String cssValue = elm.getCssValue("cursor");
                boolean cssWait = false;

                if(cssValue.equals("default")){
                    cssWait = true;
                }
                return cssWait == true;
            }
        });
And it worked!
I am just two days old to Selenium, so excuse me in this solution is not a great one.
But it worked, so posting it here.

Reported by kavishaemail on 2014-12-05 06:44:49

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Thanks corinne....@gmail.com

This worked for me

Reported by ankitrathi85 on 2014-12-05 11:08:13

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

#94 bernas_romel@yahoo.com

chrome uses point location.
browser appears to be minimize (1024X768) when you are using larger screens with large
resolutions like mine (1366X768) making chrome driver to point on wrong location.

fix: (im using java)

driver.manage().window().maximize();

it worked for me

Reported by romelbernas1 on 2015-01-08 03:25:02

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

 0 down vote


I downloaded the latest chrome driver from www.seleniumhq.org and and also latest selenium
jar file 2.44 version and ran using this code and I could make the element be clickable.

Code used is

// Find an element and define it WebElement elementToClick = D9.findElement(By.xpath("xpathcode"));

    // Scroll the browser to the element's Y position

((JavascriptExecutor) D9).executeScript("window.scrollTo(0,"+elementToClick.getLocation().y+")");

            // Click the element

elementToClick.click();

Thanks,

Pardhiva E.

Reported by pardhiva78 on 2015-02-19 19:37:10

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

After some significant frustration, I have solved this issue for my problem.  I got
this error in Chrome, but not Firefox.  What tipped me off what my screenshots did
not quite scroll to the bottom, even though I ran:
((IJavaScriptExecutor) driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight);");

I clicked on an element that populated a table.  The table was still populating, when
the screenshot occurred, and consequently, the position of the button would also change
slightly.  Meaning, the table was growing when I was about to click on the element.

Reported by GlassMill on 2015-02-26 20:31:29

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Here's my solution:

  void clickByAction(By locator){
        waitUntilElementIsPresent(locator)
        WebElement element = driver.findElement(locator)
        Actions actions = new Actions(driver)
        actions.moveToElement(element).click().perform()
    }

Reported by homebrewguy on 2015-03-26 21:02:57

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@romel

This worked for me also, thanks for the fix!

driver.manage().window().maximize();

Reported by elsid@perrysysinc.com on 2015-04-01 16:01:25

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Issue was fixed for my case when I increased the sleep timer.

Thread.sleep(60000);

Reported by jerry.maala@sitebot.org on 2015-04-21 17:01:16

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This is quite good workaround made by me:
I have made my method that uses selenium click method.
first I made a loop that tries to click 'n' times in a row if prevoius try failed.
public static void myClick(WebElement element)
e.g. n=5

int n=5;
for (int i=1; i<=n; i++)
{
    try {
        element.click();
        break;
    } catch(WebDriverException driverException) {
        System.out.println("Click on element failed. Attempt: "+i+"/"+n)
        Thread.sleep(1000);
        }
   if(i==n)
   {
    Assert.fail("Failed to click "+n+" times");
   }
}

It will work 99% of time, cose sometimes element is not yet click able, sometimes browser
could not scroll fast enough to element (so second check will work), sometimes animation
of element or server response is too long, and most times because of so called 'f**k
you' error.

Reported by Hubert.Trela.softit on 2015-04-24 08:50:54

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I have no idea why some element are not clickable via Chrome driver.
But when I use java script to force click the element, it's work properly.

Maybe the Chrome web driver handle elements different from another driver.

        WebElement we = driver.findElement(By.cssSelector("#productListing * td.product-name-td
> a:nth-child(1)"));
        WrappedPack.clickHiddenElement(driver, we);

Reported by nick@webon.net on 2015-05-07 02:11:14

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

If you do not use waits, it's possible for ChromeDriver to click element before it is
even loaded properly... You should use waits to check if element is clickable and then
run click.

Reported by Hubert.Trela.softit on 2015-05-07 07:21:00

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

If you are using BrowserLink in Visual Studio 2013, Browserlink will display a navbar
at the bottom of the browser page. If the item you want to click is behind that navbar,
you will get an error that the wrong thing will be clicked. Disabling BrowserLink fixed
this issue for me.

Reported by jpsowers on 2015-05-07 18:09:51

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

OMG! It is still not fixed. Fair enough! 2 years passed

Reported by serhiiaksiutin on 2015-07-26 12:12:28

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Come on Google, this is definitely not 'Won't fix' material.  Sometimes I can't believe
I'm writing special code for Chrome while IE is passing with flying colors.

Reported by mike.scragg on 2015-07-29 20:56:09

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This issue may happen which element we gonna click that might not be in browser visible
area. I have faced this same issue on below scenarios

My browser scroll bar automatically went middle of page due to more number table row
in the current page which i wants to navigate and perform. But my expected clickable
element present at the top of the page. So here chrome driver searching the element
from current visible area from to bottom.(not searching/finding the top element).

Due to this reason I have faced this at clickable at (x,y) issue in chrome browser.
Finally I fixed this using "((JavascriptExecutor) driver).executeScript("window.scrollTo(0,0)");"
before my expected element click.

Now driver visible area went to top, from there it start search from top to bottom.

Reported by manisundhar07 on 2015-07-31 14:59:37

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Take screenshot right before and after (i.e. in a catch block) the error
occurs, if you haven't already.  If you need help with this, I can paste
sample code.

Reported by jaemzware on 2015-07-31 21:14:43

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Have the same the issue here
Exception: unknown error: Element is not clickable at point (432, 785). Other element
would receive the click: <div class="modal-backdrop fade in" ng-class="{in: animate}"
ng-style="{'z-index': 1040 + index*10}" ng-click="close($event)" modal-backdrop=""
style="z-index: 1040;"></div>

Driver info: chromedriver=2.15.322455 (ae8db840dac8d0c453355d3d922c91adfb61df8f),platform=Mac
OS X 10.9.5 x86_64

Find a workaround is just a hacky way to click space outside modal to dismiss that.
But ideally we want the button to be clickable
Anyone have other solution?


Reported by yunhanch512 on 2015-08-07 21:49:48

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Try using webdriver wait with expected conditions

Ex:
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#submitButton")));

If you wanna read more
http://seleniumeasy.com/selenium-tutorials/webdriver-wait-examples.

Reported by aditya.dhingra89 on 2015-08-07 22:49:57

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I found this issue while writing webdriver scripts for a mobile application written
with jquery mobile.  Everything runs fine in firefox, but when I changed to chrome
suddenly it just blows up on like the 3rd step, never mind the other hundreds of steps
that firefox will run through.  The element which fails (a checkbox) has been "enhanced"
for mobile viewing via the jqm library, and I suppose maybe the underlying "checkbox"
is not visible.  However, semantically and practically it is still there and should
work the same.  That's the idea of progressive enhancement, the raw semantics don't
change just the presentation.  This is a very common library and it appears that this
type of mobile app is untestable with chrome webdriver.  One thought is that you could
use a "strict" option to the driver config which might disable this "extra checking".
 Certainly it is intended to be helpful but it does not end up helping in every real
world case.  I really hate to add any hackish workarounds to fix this.  The semantics
are clear and the test script should be based on simple ideas like "click the checkbox"
not "find the div that has xyz class that is surrounding the checkbox and click it
(and pray these things don't change)".  If other browser drivers are doing it without
issues, why not chrome?  I guess I'll go hack some javascript or something ugly, since
I can't hold my breath until 2019 to see if someone cares enough to look at this again.
 But don't let that stop you, it is too late for me, but other people will need the
fix, help them.

Reported by logichype on 2015-08-20 06:48:37

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

For the folks who have to put in a hack, here is the gist of mine, which seems to work
(Element-34 php webdriver).

The main point is to execute the javascript on the element.  Lucky for me I have it
wrapped in a click abstraction which allows me to customize based on browser.  It is
fairly clean, as hacks go.


    function click($using, $selector)
    {
        global $conf;
        $el = $this->wait->until(
            function($session) use ($using, $selector) {
                return $session->element($using, $selector);
            }
        );
        if( $conf['browser'] === 'chrome' ){
            $this->session->execute(array('script' => 'arguments[0].click();', 'args'
=> [array('ELEMENT' => $el->getID())]));
        }else{
            $el->click();
        }
        sleep(1);
        return $el;
    }




Reported by logichype on 2015-08-20 07:41:27

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:00

  • Labels added: Restrict-AddIssueComment-Commit
@lukeis lukeis closed this Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant
You can’t perform that action at this time.