Open a new tab and return to the original window
Automation taskMediumAsked in: Accenture, Capgemini, Cognizant, Infosys, TCS, Wipro
One of the most asked tasks: "Click a link that opens a new tab, check something there, close it and come back." Save the original handle before anything else, because you need it to return. In this lesson the new tab is opened with the Selenium 4 call (newWindow in Java, switch_to.new_window in Python) instead of a link click; you then read its title and switch back to the saved handle.