Visibility Criteria
The conditions that decide whether the element is visible or hidden within the viewport are known as visibility criteria. For performing any action on the element in the web page, either you need to make that element appear within the viewport or forcefully click that element.
Below are the different methods of forcing Selenium WebDriver to click on the element that is not currently visible:
1. Recommended Approaches
- Wait for Visibility
- Scroll the Element into View
- Address Underlying Issues
2. Less Recommended Approach
- Forceful Click using JavaScript
How to Force Selenium WebDriver to Click on Element which is Not Currently Visible?
A programming language that is used to execute a set of instructions that a computer can understand and execute to perform various tasks is known as Java. Java can be controlled autonomously using various automation tools.
Table of Content
- Visibility criteria
- Wait for Visibility
- Scroll the Element into View
- Address Underlying Issues
- Forceful Click using JavaScript
- Conclusion
- FAQs
Selenium is one such tool, that can make the work of developer and tester easier. There are various instances when the user needs to click or perform a certain action on the element that is currently not in the scope of visibility. In this article, we will see how we can forcefully click on an element that is not currently visible using Selenium webdriver.