Click on an empty cell


I’m trying to scan a web table to find an empty cell and click on it. But the scan doesn’t find an empty cell while there is some.

Here is the scan :


Table :


  1. I don’t see the id attribute for your table’s xpath, id=‘create-intervention-calendar’. What count do you get for your first Rows.size?
  2. if Rows == null, then the row shouldn’t exist. Should the contents of the Rows be blank instead?
    String cellText = Cols.get(j).getText();
    if (cellText == ‘’) {
if (Rows == null || findTestObject('Object Repository/Page_Kibati  Dtail de lintervention - planning/div_planning')==false)

This line does not make sense to me.

As @grylion54 pointed out, Rows == null should not be there. Because it is obvious that Rows is NOT null.

A findTestObject(...) method call returns an instance of com.kms.katalon.core.testobject.TestObject. It does not return a Boolean value. Therefore a test statement findTestElement(...) == false is ambiguous.

Do you want to test if the cell is empty? In other words, you want to test the content text of each cells? Then how about trying this:

if (Cels[j].getText() == null || Cels[j].getText().trim().length() == 0)

You have this:

table: for (...) {

        table: break

Here the label table: is unnecessary. It just mystifies the code. Why not you write:

for (...) {

    if (...) {

Indeed I want to test if the cell is empty. To be more accurate if there is a block/div in it (like the exemple just below) :


Your solution is interesting but I don’t understand what is “Cels” ?

My bad typo. To be in line with your code I should say


So I followed your instructions :

But it clicked on a no empty cell :


And click on this block (I think) :


This is not working as you (I) expected. OK, you should try other ways. — I can not do it for you as I do not have immediate access to you Application Under Test.

You can find the javadoc of org.openqa.selenium.WebElement here.

WebElement.getText() is just one of the variaty of methods to us. Please try other methods and try to find out solution.

For example, try List<WebElement> findElements() methjod to find out if it contains any child elements such as <div> or <span>

So I read the documentation and I did that :

But I got the following error message :


Here is what looks like a block :

I found a highly active discussion in about StaleElementReferenceException.,