w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
676 stars 190 forks source link

Provide more information on `element click intercepted` error #1679

Open christian-bromann opened 1 year ago

christian-bromann commented 1 year ago

A common issue when automating with WebDriver is that other elements block access to a desired element to interact with. Some drivers, e.g. Chromedriver provide a somewhat useful message like:

element click intercepted: Element <div class="cup-body" aria-label="Americano" data-test="Americano" data-cy="Americano" data-v-7a0f9f00="">...</div> is not clickable at point (376, 548). Other element would receive the click: <div class="pay-container" data-v-a32a8090="">...</div> (Session info: chrome=104.0.5112.101)

It would be super helpful for frameworks if such an error could provide the element id of that element that has blocked access. It could allow framework authors to run a set of corrections, e.g. scrolling element to a different end of the viewport, in order to mitigate the problem.

whimboo commented 1 year ago

In our implementation for Firefox we are adding an error message like Element <input type="button"> is not clickable at point (32,19) because another element <div> obscures it. Hereby we are trying to get as much as possible information to let the user identify the relevant element that overlays the target, but it's not always possible - maybe a fallback to eg. an XPath might be needed.

christian-bromann commented 1 year ago

As framework implementer anything that helps to get ahold of the element would be useful, e.g. a selector or element id, whatever is possible.