mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.03k stars 1.51k forks source link

Gecko driver element click command is failing on certain webpages because the driver is not first scrolling it into view #2113

Closed demdante closed 1 year ago

demdante commented 1 year ago

Hello. I recently started using a Webdriver UDF (user defined function) for the scripting language AutoIT to automate some tasks in firefox. Now I already know that you are going to want to blame third party udf for the problem. That was what I initially thought too, which is why I initially created the an issue for the au3webdriver github repo. See the linked issue for all of the details concerning the issue, but, to quickly summarize, I wrote a script which is supposed to fill out and submit an online form (I provide the entire script in the linked github issue), and it does what it is supposed to perfectly right up until the script attempts to click the button which would submit the form. The first attempt to click the element in question fails because the driver is not scrolling the element into view before attempting to click it. However, it does appear to be scrolling the element into view after attempting to click it, as attempting to click the button again after a 1 second pause successfully performs the action. The linked issue contains more details regarding the issue, how to re-produce it, and the troubleshooting performed which led us to conclude that the issue is, in fact, with the gecko driver. For example, the error that is logged when the issue occurs reads as follows:

400 Bad Request {"value":{"error":"element not interactable","message":"Element <input id=\"form_20_22\" type=\"submit\"> could not be scrolled into view"

Which is the same error that the element click command returns when the element is, according to the documentation, being blocked by another element, but, in this case, the error is occurring because the webdriver is not scrolling the page to make the element visible before attempting to act on it.

System

Testcase

https://storeurll.z13.web.core.windows.net/wh.html

Stacktrace

1670774034164 webdriver::server DEBUG -> POST /session/36eeb4b9-1697-404a-88de-3023b5a8a8cd/element/1d82eb50-10c6-42b0-ad6a-afab4ffc9127/click {"id":"1d82eb50-10c6-42b0-ad6a-afab4ffc9127"} 1670774034170 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"element not interactable","message":"Element <input id=\"form_20_22\" type=\"submit\"> could not be scrolled into view","stacktrace":"RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:182:5\nElementNotInteractableError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:292:5\nwebdriverClickElement@chrome://remote/content/marionette/interaction.sys.mjs:150:11\ninteraction.clickElement@chrome://remote/content/marionette/interaction.sys.mjs:119:11\nclickElement@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:198:29\nreceiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:86:31\n"}}

Trace-level log

whimboo commented 1 year ago

Could you please attach a trace-level log from geckodriver? Also the referenced testcase is not accessible. As such there is not much we can do right now.

whimboo commented 1 year ago

No further reply from the reporter. Closing issue as incomplete for now but I'm happy to reopen when the requested information have been added.