To Convert Selenium | Java Code to Katalon - Groovy

This Piece of Java Code works well in Selenium. I would like to try now in Katalon - Groovy. Could you please guide me on this. Thanks in advance.

Selenium Java Code:
WebElement ele1, ele2;
ele1 = driver.findElement(By.id(“main”));

List<WebElement> ls = ele1.findElements(By.xpath("/html/body/section/table"));  
for(int k=0;k<ls.size();k++)  
{  
    WebElement we = ls.get(k);  
    List<WebElement> ls1 = we.findElements(By.tagName("td"));  
    for(int l=0;l<ls1.size();l++)  
    {  
           WebElement we1 = ls1.get(l);  
            
           if (cellVal\[4\].equals("Local"))  
           {  
                          
               if(we1.getText().contains(cellVal\[5\])) // to compare the value with Excel cell value.  
                
                        {  
                  ele2 = we1.findElement(By.xpath("following::a")); // to click on the hyperlink 'Click' of corresponding record matched above.  
                 ele2.click();  
                 break;  
                        }  
                                        
           }  
            
      else  
             if (cellVal\[4\].equals("Global"))                                                               
             {  
                 
                if(we1.getText().contains("Manager"))         
                    {  
               
             ele2 = we1.findElement(By.xpath("following::a"));  
             ele2.click();  
             break;  
                    }  
     
             }  
                      
               
            
     }  
     
}  

Sample.jpg

kazurayam -
Could you please check and help on this.

Test Q , Drunda Nibel - You could also have a look on this and kindly help me on this.

That is not a complete code. It at least lacks “driver” definition (instantiation… if that’s the right word), also cellVal[].

Could you please guide me on this.

No, I can’t. First you should try what you think right.

When you encounter errors or questions which you cannot solve, then post it here for help with enough information (target HTML, Groovy source, log, etc).

Thanks for your suggestion of trying myself first :slight_smile:
It worked. I was able to do it after trying multiple times.