How to use custom ResponseParser?
onelesd opened this issue · comments
The warning below is printed when an element is found on the page and is visible, but it's position shifts due to a changing DOM before the click() is executed.
find_element({:xpath, "//span"})
|> click()
16:33:06.734 [warn] unknown error: Element <span>...</span> is not clickable at point (1153, 90). Other element would receive the click: <div></div>
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.2 x86_64)
No exception is raised (unlike a click() of an element that is not visible, which raises "element is not visible"), so there is no way to catch this error and try again.
A kludge is to sample the element's location N times before attempting the click, but we still have a race condition that is prone to breakage.
Is there another technique?
I see that warning?/1 is defoverridable in Hound.ResponseParser, which I would have raise the exception. It seems to be hard-coded based on the selected driver here:
hound/lib/hound/request_utils.ex
Lines 61 to 73 in 7b3ff55
How do I set a custom ResponseParser?
Hi, sorry for the delay.
The current implementation does not allow to set a custom parser. If you would like to send a PR to implement this, you are very welcome.
Thank you.