selenium close tabs code example
Example 1: close tab selenium python
There's nothing easier and clearer than just running JavaScript.
Open new tab: driver.execute_script("window.open('');")
Example 2: selenium close current tab
driver.close();