The error I'm getting is: element not interactable: element has zero size
I have an element with a button tag with text. However, the element.style
has two attributes of 0px
height
(and 0px
padding
, if that matters).
The only workaround I've found is to interact with some other element that I can find (higher up in the hierarchy of the markup), and then use x
and y
offsets to click this button. However that ends up flaky because the size of the element can change, and the button is off to the lower right corner.
I'm willing to go the extra mile and calculate the proper coordinates, but I'm not able to figure out how to get the width of the element either. I'm also willing to just use some javascript to click as a last resort. Ideally I'd love to know if there is something more clean and elegant for this problem.
Thank you!
I ended up using actionbuilder to work around this problem, like this:
el = find('button', :text => '+ 1').native
actionbuilder = page.driver.browser.action # Use actionbuilder to workaround zero height button
actionbuilder.click(el).perform
I'm not sure if this is the way to go but that seems to have helped and maybe might help someone else out there.