I want to close the current tab of the browser? how can I do that?
You can try the below code in User Defined Java class. This code works fine for selenium with Java :
ArrayList switchTabs= new ArrayList (driver.getWindowHandles());
driver.switchTo().window(switchTabs.get(1));
driver.close();
driver.switchTo().window(switchTabs.get(0));
Note: close the tabs based on your requirement
Should I write in main method of class ?