During test execution, there is no way to highlight an element. This will help us to see what is actually going on in the browser. This method will slow down the tests a bit, but sometimes it's a useful way to debug tests.
In this recipe, we will create an extension for
WebElement and provide the
highlight Elements() method at runtime.
Create a new Java class file for the
WebElementExtender.java class, or you can use the class created in the previous recipe.
highlightElement() method to the
WebElementExtender class, as follows: