switch the browser tab and close that tab code example Example: selenium close current tab driver.close();