https://cypress.io logo
Button exists on DOM and clickable but not showing...
# i-need-help
c
Button exists on DOM and clickable but not showing on UI. Tried adding wait time to fully load the page but still not showing. Running on Cypress 12.2.
s
Could you please give some more context. What is the issue? YOu cannot click it?
c
Here, there should be a button visible (btn-primary) on top and as you can see it exists in DOM and also clickable by using the click() command. It's just weird that it is not showing on UI.
only happens on automation and not by doing it manually.
s
any errors when you try and click it?
did you try to use force:true on the click ?
c
Found a solution. I have added focus() and force:true on click.
l
If it's not showing in the UI that alone might be a bug (but I'll assume you know best here). If your site has hidden elements that you don't want to
get()
by accident, throw a
:visible
suffix on your selector. That will filter out anything hidden. Like this:
cy.get('#okayButton:visible').click()
9 Views