I have a two like like below
<body>
<a href="contact.php" target="_blank">contact</a>
<a href="test.php" target="_blank">Sest</a>
</body>
After click on link page has open in new tab , I want to close this tab without close driver, Is it possible ? I have tried below code but not working.
link = driver.find_element_by_xpath(
"//a[contains(text(),'contact') or contains(text(),'est')]")
link.click()
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 'w')