I need for my program to press a toggle button if I cannot interact with whatever I’m trying to press on a sidebar of this website: https://automationtesting.co.uk/
The problem is that whenever the sidebar is not visible, all the elements inside it will still be present in my DOM. I cannot check whether they’re displayed, enabled, or clickable – because such condition checks, for some reason, will always return true, hence they’re useless.
What can the solution be?
I tried:
- Regular condition checks: isDisplayed(); isEnabled().
- Wrapping the code in a try-catch blocks and attempting to check whether the element meets a certain condition via explicit waits.