-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.click broken for Selenium 3 #322
Comments
I was able to reproduce. However, hitting return on the element works
|
Great that Keys.RETURN works, thank you. |
@AutomatedTester Do you have an idea what’s wrong here so we can file a Marionette bug? |
I havent looked into the html, but feels like there might be something is catching the click that shouldnt be or something like that |
I have experienced a number of issues where GeckoDriver and Selenium 3 clicks are broken when they are working in other browsers, however, I don't have a public reproducible test case :( In my case, I have clicks which:
but do not work with GeckoDriver 0.11.1 with FF Nightly or FF 49.0.2 In my case the element is found and there are no exceptions thrown - the click simply has no effect. I'm attempting to find a public demonstration of this, which led me to this issue, however, in this instance, I am getting an driver.get("http://phptravels.com/demo.php/");
WebElement element = driver.findElement(By.xpath("//a[@href='//www.phptravels.net/admin']"));
//I thought moveToElement might help but this doesn't appear to be implemented in GeckoDriver yet
//Actions actions = new Actions(driver);
//actions.moveToElement(element);
//actions.click();
//actions.perform();
element.click(); |
The problem I'm seeing is with clicking on text fields. Calling element.click() changes the current active element (document.activeElement), but it seems that focus events are not firing. For example, given the URL [http://phoenix.pslc.cs.cmu.edu/QA/Tutors_trunk/html5_interfaces/fractionAddition.html?tutoring_service_communication=javascript&question_file=http://phoenix.pslc.cs.cmu.edu/QA/Tutors_trunk/html5_brds/FractionAddition/1213.brd], the following code worked in Selenium 2, but it does not work in Selenium 3 with the gecko driver (i.e., the text in e1 does not turn green):
|
I am using C# for programming Selenium tests. For me the following code works (so without gecko driver?):
And this does not work (with gecko driver):
I have 64 bit version of gecko driver (geckodriver-v0.11.1-win64) and the gecko driver seems to be launching 32 bit version of firefox. The test works up until the first Click event. I can see that there is this stange opacity on the page where the click does not work. Additionally the click does not work even when continuing to to use the browser with mouse like you normally would. If I hit return on the page, I get to the next page and the opacity disappears. On the second page the click once again operates normally when used with a mouse. If I add the SendKey, the rest of the test goes through just fine: |
If anyone can help reduce the HTML needed to get this issue fixed that would help us fix it quickly. |
This code works for Chrome: But results in this error for Gecko: I've not yet found a workaround to implement a click on an anchor link. It's the MoveToElement that's broken in this driver. Any ETA for a fix to this? |
@jsaltz the NotImplementedException means literally that - Actions are not yet implemented in geckodriver. This issue is highlighting a problem where an element is found (is visible and clickable), but the click method has no effect and no Exceptions are thrown. |
I got a jquery workaround for this. Fun at the old Firefox ballpark |
Here is a crude workaround for the click not pausing long enough for the page to fully load:
|
I can confirm many, many troubles sending clicks. It's particularly bad with radio buttons and checkboxes but has also manifested on list items, hrefs and input type=submit. In some cases I've been able to work around by scrolling the item further into the viewport using a window.scrollTo() or window.scrollBy() JS call. Other times I'm just completely stuck and have to send key presses instead. I've noticed that at certain times of day I can click something and at other times (randomly) I cannot. Our entire collection of test suites passes flawlessly against Chrome. Firefox: 50.0.2 |
I'm replicating this issue as well. It seems geckodriver can't click game elements ( Specs: Example in Capybara:
geckodriver Debug Logs:
I've also done typical debugging such as adding sleeps, etc. An element gets returned upon clicking, but the click doesn't go through. As described above, sending the enter key works.
|
@dylanlive When you say it “can’t click elements”, what do you expect to happen when the element has been clicked? For a new page to load, or for the DOM state to change? I’m quite sure that in both cases the clicks do happen, but that it in the first case does not wait for the new document to load, and that it in the latter case works just fine. |
@andreastt Thanks for responding. DOM updates on click - there's no full page reload. If you mean a coded expectation, while debugging this, I'm not making any. I've hardcoded a 5 second sleep to visually ensure the click occurred. Here comes an info dump... I've been experimenting a lot today, and found a fix for my specific case - I had to refer to a class a few levels up in the DOM. URL: https://twitch.tv/directory
It's intriguing, because the Ember action and href is associated with the
I converted my example to a Selenium Ruby script, perhaps for easier replication. Example of the .click method, not working:
Example of the .send_keys method, working:
If you downgrade to Firefox 45.6.0, and set marionette to false in the above scripts, you'll see the click script works, so I'm fairly certain something changed in behavior with geckodriver (whether it's truly a bug... not yet sure). Also noticed the Javascript Click event will work: |
Even I am facing issue with click. I have noticed that when this issue is seen, URL area is highlighted in "blue", the cursor is in the URL text area. If I click inside the client area in the browser (anywhere) (before click call), the click is send properly. |
Just wanted to add that I've encountered the same issue with random click failures using the latest release of geckodriver and FF 51. My tests work flawlessly on FF 47 (with the old driver), Chrome, and IE 11 but FF 51 and geckodriver are a no go. I've tried using the Keys.RETURN trick and sending a javascript click with various success. It clears up some of the problems and but tends to create others. |
Agree with the comment by @joshipratik above - the URL bar (awesome bar?) is highlighted in blue. If I add a sleep before the click and manually click (set focus to) the page, then the previously failing click works as expected. |
@joshipratik @danhumphrey Focus on the address bar seems to be a separate issue? That in particular was reported in #394 and fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1328676 in Firefox 52 onwards. |
confirmed @andreastt - updating Nightly resolved it. Thanks! |
the Focus on the address bar seem to be fixed, but not the inital Problem of this issue (.click() ) Oh and its not only the .click() - for me the same issues is for send_keys() Tested with latest gecko and aurora. Very annyoing for tests :( |
.click, .sendKeys(KEYS.ENTER), .sendKeys(KEYS.RETURN)
(on Firefox 51.0.1 (64-bit), Mac OS) |
Perhaps this helps in debugging this: for me it seems that simply repeating the click event (normal hyperlink) seems to help very much. i.e. I now have this in some places in my code: # workaround for https://github.com/mozilla/geckodriver/issues/322
# where the click sometimes is swallowed. Should be fixed in the comming weeks
self._find_element(By.LINK_TEXT, "Vorschau").click()
self._find_element(By.LINK_TEXT, "Vorschau").click() |
I'm using Selenium 3.4.1, Firefox 53.0.2, and geckodriver 16.1. Navigating to the site agendaweek.com (screenshot below), I was able to click this log in button in Selenium 2.53.6 but now I can't. The click action goes through and proceeds to the next line of code so no errors are given but in reality, the button does not get clicked on. |
@AlphaTangoFoxtrot Please file a separate bug with a reproducible test case. |
@whimboo Regarding your comment: https://bugzilla.mozilla.org/show_bug.cgi?id=1374283#c1 |
@heyrex, a trace won't help here given that the click is just not happening on the real element and as such doesn't produce any helpful output. What you could try is to save the page via "Webpage, complete" so it contains all referenced files. Then try to load it via localhost. If it still fails try to remove the doctype, or the |
What do you mean with |
Has this issue ever been fixed with geckodriver or has anyone found a solution or workaround for their automation? I'm seeing this exact same problem. |
@MartinSoeesJohansen, I had a look at your issue today with Firefox versions starting with 55.0 up to 57.0a (Nightly) and I cannot reproduce your issue anymore. Can you please check that it works for you now too? For all others, please upgrade to the latest Firefox and geckodriver release, and test your code again. If |
Just to mention what worked for me, as I had the same issue, some regions get clicked, others not: For instance, "findElement(By.linkText" works fine, but in my case, I needed to find it by an id (never mind). I called click two times in a row and it now works, not sure what the problem was. My Firefox is 54.01. (32 bit), on Windows 10 (64). The gecko is v0.18.0 |
The firefox update (and any updates for that matter) are a complicated procedure in our company. Let's just say, I updated to 55.0.2 (32-bit) and it now works. Not sure if it had something to do with the firefox itself to be honest, but it might be the cause ... |
@g000dy geckodriver itself is just a simple HTTPD that provides the WebDriver API. It proxies calls to the Marionette remote protocol in Firefox, where most of the heavy lifting goes on. This means that most fixes we make to improve our WebDriver support happens in Firefox. geckodriver is however not tied to a particular version of Firefox because they communicate over a transparent remote protocol. |
@g000dy You mentioned clicking twice in a row. I've also run into a scenario where the first button click consistently fails and the second click succeeds. I'll see if I can come up with a consist test case. |
A testcase would be great. I think that this issue might be related with bug 1394354 for Marionette. |
We are seeing this issue with webdriver.js For example clicking links on a navbar seems to focus on the link however the click never happens. I've read a lot in this post and it seems like this currently is not working? So far I've tried the following Also, when I do the click, I've tried clicking our own Id, also bytag and by getattribute("href") Selenium webdriver.js version 3.5 In my .then statement, I am passing the navigation bar links in (our data-auto value from our own product code). I log out the count to make sure I get them then I use the below code to click each one. What I see is each link highlight but no click happens where I should be brought to another page. This test is to click each link one after the other in a loop and then do something.
The F12 underlying link looks like this. I took out the end tags <> so you can see the below a class="_3ponYMwshNSq6kAmWIMfI1" data-auto="globalnav-link" href="/skills/browse/Nursing%20Skills">Nursing Skills</a *Using Chrome, click works as expected |
@JamiePendleton without a trace log and even better a HTML snippet to reproduce it we cannot help. So if you have one which permanently reproduces the problem please provide it to us. This would be totally helpful. Thanks. |
I'll post more soon if need be, for now however on sauce labs, the same tests that were failing at click now work. I am not sure how yet, but the tests passed. I'll need to see if I can get a repro. |
I'm encountering the same issue( have to call click twice) for element to be clicked. |
Its working for us now but was failing clicking the second link in our nav bar . Here is the element |
I am also facing same problem with Geckodriver. Click events are not working, However working fine for chrome and older versions of firefox. is Geckodriver not stable yet to make a switch from Selenium 2.0 to 3.0? Or am I doing anything wrong with its integration. |
@automationgeeks, we cannot guess. You haven't given any details about your issue, and at least a trace log would be very helpful. @jpatel13 thank you for the testcase, but the test doesn't match with the HTML you have provided. Please make sure to fix it. Otherwise it's not that clear what to run. Thanks. |
I got the a similar trouble, after a click event, a div is hidden and another div gets visible, the second div contains some elements including checkboxes and a button, when i try to click one of these elements i get a ElementNotInteractableException in FireFox, but works well on Chorme and IE i've tried with many wait methods and can't get it working |
@andresmauriciogomezr I would file a separate issue instead of hijacking this, but it sounds like that is a result of the newer and stricter element interaction rules in WebDriver that aren’t implemented in Chrome and IE yet. See https://www.hskupin.info/2017/12/15/element-interactability-checks-with-geckodriver-and-firefox-58/ for more details. |
I’m going to go ahead and close this issue because it doesn’t have a concrete description of the problem or a trace log we can use to debug it. The test case that was originally quoted can’t be reproduced in recent Firefox versions. I should also add that we have made a series of large changes to how element clicking works to align geckodriver closer to the WebDriver standard. Some of these changes may affect your tests, so if you have concrete concerns about how it works it will be better to file new issues on those. |
@andreastt I have a failing test case and trace log in #1007, which was closed as being a duplicate of this. Can that one be reopened? |
@elliterate Done. |
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue. |
As with Selenium 3 and the need of geckodriver for web browser testing the .click() is broken.
Environment:
Windows 7
Firefox 49.0.2
GeckoDriver 11.1-64bit
Selenium 3.0.1
Python 3.5.2
Elements can be found by Selenium either by xpath, css or link text, but .click() is not performed.
Please see the Stack link for a detailed explanation of what I've done so far.
EDIT: it seems to be working on pages without heavy javascript source code. So it might be geckodrivers ability to handle javascript??
This page works: www.dr.dk
This page doesn't work: www.phptravels.com/demo
A longer, thorough, explanation can be found on Stack here
The text was updated successfully, but these errors were encountered: