I have a web page, that has a table, that uses a pager, and that have different filters to filter the columns. The table contains 50 rows per page.

After applying a filter I want to count how many rows the filter has returned; to do so I need to go through all the pages that are available and for each page count the number of the rows that are there.

To go to the next page I have an right arrow > that I can click on. When I am on the last page, the arrow becomes disabled and I can no longer click on it.

My question is: is there a way to test if the arrow is still clickable?

I should mention that my home page uses AngularJS to populate the table, so I use ng-click and give it a method that load the next page of the table.

  • Have you tried anything yet? Can we see the script you have written? Commented Nov 3, 2016 at 2:58
  • Yes I have tried something. I used a while loop that tested if the arrow was still visible and was getting an infinite loop, and saw that the condition will always be true as the arrow is never hidden. So I tried an other approche with an if statement. @TESTasy
    – mupierrix
    Commented Nov 3, 2016 at 11:44
  • What did the if statement do? Commented Nov 4, 2016 at 1:24
  • Sorry I took too long to respond @TESTasy. I used the "if" statement to verify if the DOM element was present and if it was visible. And inside I used a while loop to verify if the total number of data the whole table is the same as the total I expected. If the actual total number is not equal to the expected one I click again to the arrow. This prevents from going into an infinite loop. But I hope in the future to optimize that and combine the loop and the "if" statement.
    – mupierrix
    Commented Nov 10, 2016 at 19:50

4 Answers 4


you can use this:

WebDriverWait wait = new WebDriverWait(driver, 10); 
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id(#yourElemnt);

If you only want to verify if the element is clickable you can use


This is a boolean method from WebDriver, so on the last page you can combine this with an Assert in your junit script to see if the webelement is enabled or not

  • I believe this would work for only standard html elements.
    – Alexey R.
    Commented Aug 30, 2017 at 11:05

There are two ways: locate optional element (if arrow to next page is hidden), or check if arrow is enabled (if arrow is not hidden but just disabled).

How to deal with optional element: find_elements() will not wait, but return list of elements using your location strategy. So if list is empty, there are no such elements.

If element is present (displayed) but disabled: Python and likely other languages have a helper class expected_conditions. It has many useful goodies (read the docs), one of them is element_to_be_clickable.

Yes, Python works hard to make code readable. Seems you are beginner programmer, I highly recommend using Python with Selenium, and learn to use interactive debugger pdb to inspect your elements. Saves me ton of time every day.

  • 1
    I haven't used Python. I am using java and JUnit. But I am going to look if those methods exist in Java too.
    – mupierrix
    Commented Nov 3, 2016 at 11:46

Well, basically it depends on how your arrow is getting diabled (as far as I understand you're talking about some non-standard UI control). In the most cases when an element is getting disabled it is changing it look (a picture that reprensents that element) so that the user is aware that it does not make sense to interact with an element any more.

To make a browser display such the element in "disabled" way the application code (in most cases JS on a client side, if the application is well-designed) should assign the corresponding style to that element (say, the style would assign "disabled" picture to that element)

Now we need to figure out the following: which particular css property is assigned to the element when it is disabled. To do that you can go in the following ways:

  • Ask an application developer (the most easiest way)
  • Examine the difference of disabled and enabled element style using browser dev tools (use F12 to call the tools in Chrome browser)

Now you should pick the appropriate value that represents "disabled" state of your element and thus you would be able to decide whether on your particular step the arrow is enabled or disabled. Details of such operation are described here: https://stackoverflow.com/questions/18452790/how-to-using-webdriver-selenium-to-get-the-value-of-style-element

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.