I get the button element by Xpath, but when try to click on it, getting element not visible exception.
<div class="modal-footer">
<button id="btnRegister" type="button" class="btn btn-primary btn-block">Register</button>
</div>
The parent div
<div class="modal fade in" id="registration-window" tabindex="-1" role="dialog" aria-labelledby="register-title" aria-hidden="false" style="display: block;">
To add to the list of things you can try:
The problem may be a little more complicated than that the element is just not currently visible. There may be an invisible element in front of it that is keeping it from being visible no matter how long you wait. In which case, there are a few ways that you can still get ahold of it:
Scroll to it with javascript:
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].scrollIntoView()", yourElement);
or...
Click it with javascript:
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click()", yourElement);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With