I was creating an automation test to verify that TeamMentor’s About page was displayed correctly. After opening the About page and perform the test, I wanted to close it (by looking at the small X that closes the window).
But after some attempts to look at the element by class, I received an error. The Display attribute of the element was set to false (weird because it was displayed anyway). WebDriver throws an error when you are trying to perform any operation (like the click event) in an element that is not visible or the Display attribute is false.
Using the magic of jQuery to interact with those scenarios
This method receives the jQuery script and executes it, which is really powerful. So at the time of invoking this method, you should pass your script, here is an example of how to use it:
The previous code uses jQuery to perform the raise the click event and close the window. Doing this with WebDriver (and trying to look at the element by class throws an error).
It seems like this is a good approach to be considered in the near future.