You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Reacted by LB, Sandy Demi, alexander-agri, Marek Lewandowski, Nico Brünjes, Dylan Reichstadt, nurp, Hao Anthony Liu, Jastin Biber, Andrej and 17 more
Great that Keys.RETURN works, thank you.
I'll try and implement that, but shouldn't it still be possible to use .click? It sucks to be having to write hacks for Firefox because geckodriver doesn't work properly.
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:
Work in all browsers (including Firefox) using Selenium 2.53.1
Work in Chrome and Edge using Selenium 3.0.1
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 ElementNotVisibleException with the following code:
driver.get("http://phptravels.com/demo.php/");
WebElementelement = driver.findElement(By.xpath("//a[@href='/p/https://github.com/p/https://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):
WebElement e1 = driver.findElement(By.id("ctatdiv26"));
e1.click();
e1.sendKeys("6");
WebElement e2 = driver.findElement(By.id("ctatdiv32"));
e2.click();
// assert text in e1 is green
For me the following code works (so without gecko driver?):
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
IWebDriver driver = new FirefoxDriver(service);
And this does not work (with gecko driver):
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox(), TimeSpan.FromMinutes(10));
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: driver.FindElement(By.ClassName("js-newdesign-wizard-next")).SendKeys(Keys.Return);
This code works for Chrome:
actions.MoveToElement(element).Perform();
Browser.Instance.FindElements(click).FirstOrDefault()?.Click();
But results in this error for Gecko:
An exception of type 'System.NotImplementedException' occurred in WebDriver.dll but was not handled in user code
Additional information: POST /session/c66773d7-38a6-4616-b771-e605b9c201c4/moveto did not match a known command
I've not yet found a workaround to implement a click on an anchor link.
Trying to bypass MoveToElement and Click() with SendKeys -
Browser.Instance.FindElements(click).FirstOrDefault().SendKeys(Keys.Return);
--just ends up throwing this: An exception of type 'OpenQA.Selenium.ElementNotVisibleException' occurred in WebDriver.dll but was not handled in user code
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.
In a block after determining the browser is Firefox I have:
IJavaScriptExecutor js = Browser.Instance as IJavaScriptExecutor;
//NOTE: Browser.Instance is my IWebDriver = new FirefoxDriver()
var TheAnchorTag = Browser.Instance.FindElements(TheAnchorTagYouWantToClick).FirstOrDefault();
string jsScript = "$( document ).ready(function() { " +
"window.location.href = $("a:contains('" + TheAnchorTag.Text + "'):last").attr("href");" +
"});";
js.ExecuteScript(jsScript);
Here is a crude workaround for the click not pausing long enough for the page to fully load:
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener
class EventListener(AbstractEventListener):
def after_click(self, element, driver):
sleep(1)
driver = EventFiringWebDriver(webdriver.Firefox(), EventListener())
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
Geckodriver: 0.11.1
Selenium: 3.0.1
Windows 7 64 bit
@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.
Details:
gecko-driver-0.19.0 x64 windows 10 Firefox 56
selenium-server-standalone 3.5.3 Calendar snippet.txt testfunc.txt
Let me know if you need more info.
Thanks!
@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.
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
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.
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.
Activity
AutomatedTester commentedon Nov 11, 2016
I was able to reproduce. However, hitting return on the element works
MartinSoeesJohansen commentedon Nov 11, 2016
Great that Keys.RETURN works, thank you.
I'll try and implement that, but shouldn't it still be possible to use .click? It sucks to be having to write hacks for Firefox because geckodriver doesn't work properly.
andreastt commentedon Nov 14, 2016
@AutomatedTester Do you have an idea what’s wrong here so we can file a Marionette bug?
AutomatedTester commentedon Nov 14, 2016
I havent looked into the html, but feels like there might be something is catching the click that shouldnt be or something like that
danhumphrey commentedon Nov 15, 2016
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
ElementNotVisibleExceptionwith the following code:demisk commentedon Nov 15, 2016
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):
aviita commentedon Nov 23, 2016
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:
driver.FindElement(By.ClassName("js-newdesign-wizard-next")).SendKeys(Keys.Return);AutomatedTester commentedon Nov 23, 2016
If anyone can help reduce the HTML needed to get this issue fixed that would help us fix it quickly.
jsaltz commentedon Nov 28, 2016
This code works for Chrome:
actions.MoveToElement(element).Perform();
Browser.Instance.FindElements(click).FirstOrDefault()?.Click();
But results in this error for Gecko:
An exception of type 'System.NotImplementedException' occurred in WebDriver.dll but was not handled in user code
Additional information: POST /session/c66773d7-38a6-4616-b771-e605b9c201c4/moveto did not match a known command
I've not yet found a workaround to implement a click on an anchor link.
Trying to bypass MoveToElement and Click() with SendKeys -
Browser.Instance.FindElements(click).FirstOrDefault().SendKeys(Keys.Return);
--just ends up throwing this: An exception of type 'OpenQA.Selenium.ElementNotVisibleException' occurred in WebDriver.dll but was not handled in user code
It's the MoveToElement that's broken in this driver. Any ETA for a fix to this?
danhumphrey commentedon Nov 28, 2016
@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.
jsaltz commentedon Nov 28, 2016
I got a jquery workaround for this.
In a block after determining the browser is Firefox I have:
IJavaScriptExecutor js = Browser.Instance as IJavaScriptExecutor;
//NOTE: Browser.Instance is my IWebDriver = new FirefoxDriver()
var TheAnchorTag = Browser.Instance.FindElements(TheAnchorTagYouWantToClick).FirstOrDefault();
string jsScript = "$( document ).ready(function() { " +
"window.location.href = $("a:contains('" + TheAnchorTag.Text + "'):last").attr("href");" +
"});";
js.ExecuteScript(jsScript);
Fun at the old Firefox ballpark
caladd commentedon Dec 7, 2016
Here is a crude workaround for the click not pausing long enough for the page to fully load:
heyrex commentedon Dec 13, 2016
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
Geckodriver: 0.11.1
Selenium: 3.0.1
Windows 7 64 bit
dylanlive commentedon Jan 12, 2017
I'm replicating this issue as well. It seems geckodriver can't click game elements (
.game-item) from www.twitch.tv/directorySpecs:
Firefox: 50.1.0
Geckodriver: 0.13.0
Selenium: 3.0.5
OS: macOS 10.12.2
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.
37 remaining items
whimboo commentedon Sep 27, 2017
@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.
JamiePendleton commentedon Sep 27, 2017
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.
jpatel13 commentedon Sep 28, 2017
I'm encountering the same issue( have to call click twice) for element to be clicked.
Details:
gecko-driver-0.19.0 x64 windows 10 Firefox 56
selenium-server-standalone 3.5.3
Calendar snippet.txt
testfunc.txt
Let me know if you need more info.
Thanks!
JamiePendleton commentedon Oct 1, 2017
Its working for us now but was failing clicking the second link in our nav bar . Here is the element
automationgeeks commentedon Oct 4, 2017
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.
whimboo commentedon Oct 4, 2017
@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.
andresmauriciogomezr commentedon Nov 28, 2017
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
andreastt commentedon Dec 16, 2017
@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.
andreastt commentedon Jan 9, 2018
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.
elliterate commentedon Jan 9, 2018
@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?
andreastt commentedon Jan 9, 2018
@elliterate Done.
lock commentedon Aug 16, 2019
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.